Skip to content
Snippets Groups Projects
Commit 8420ec59 authored by Trandinh Thien's avatar Trandinh Thien
Browse files

Added turn transition screen

parent b45bd00f
No related branches found
No related tags found
No related merge requests found
Showing
with 91 additions and 10 deletions
......@@ -126,6 +126,8 @@
<Content Include="GameThumbnail.png">
<XnaPlatformSpecific>true</XnaPlatformSpecific>
</Content>
<None Include="Resources\player2turn.png" />
<None Include="Resources\player1turn.png" />
<None Include="Resources\End_Button.jpg" />
<None Include="Resources\Inventory_Button.jpg" />
<None Include="Resources\exit_game.png" />
......
......@@ -35,3 +35,5 @@ Content\PixelFontLarge.xnb
Content\PixelFontLargest.xnb
Content\Inventory_Button.xnb
Content\End_Button.xnb
Content\player1turn.xnb
Content\player2turn.xnb
......@@ -35,7 +35,6 @@ namespace View
{
weapons = value;
hasItem = true;
Debug.WriteLine(hasItem);
}
}
......
......@@ -14,6 +14,7 @@ using Model;
using View;
using Blaze_Brigade;
using System.Diagnostics;
using System.Threading;
/// <summary>
/// The controller in MVC. These classes will control how the Model is used, and how the
......@@ -49,10 +50,11 @@ namespace Controller
Camera camera;
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D backGround, moveableNode, attackableNode, gameOver, endTurnButton;
Texture2D backGround, moveableNode, attackableNode, gameOver, endTurnButton, player1Transition, player2Transition;
private SpriteFont font; // custom font
private SpriteFont largeFont; // custom font 2
private SpriteFont largestFont; // custom font 3
private float ElapsedTime = 0f;
#endregion
......@@ -97,6 +99,8 @@ namespace Controller
attackableNode = Content.Load<Texture2D>("attackableNode");
gameOver = Content.Load<Texture2D>("exit_game");
endTurnButton = Content.Load<Texture2D>("End_Button");
player1Transition = Content.Load<Texture2D>("player1turn");
player2Transition = Content.Load<Texture2D>("player2turn");
font = Content.Load<SpriteFont>("PixelFont"); //loads font PixelFont
largeFont = Content.Load<SpriteFont>("PixelFontLarge"); //loads font PixelFont
......@@ -240,9 +244,20 @@ namespace Controller
Player tempPlayer = GameState.currentPlayer;
GameState.currentPlayer = (GameState.enemyPlayer);
GameState.enemyPlayer = (tempPlayer);
GameState.transitionTurn = true;
GameFunction.startTurn(GameState.currentPlayer);
}
if (GameState.transitionTurn)
{
ElapsedTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
if (ElapsedTime > 1.5)
{
GameState.transitionTurn = false;
ElapsedTime = 0f;
}
}
// removes deceased units in Player 1
foreach (Unit unit in player1.getUnits())
{
......@@ -583,14 +598,24 @@ namespace Controller
spriteBatch.Draw(backGround, Vector2.Zero, null, Color.Black * 0.5f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.9f);
}
if (GameState.endTurnButton)
{
spriteBatch.Draw(endTurnButton, GameState.endTurnButtonLocation, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
spriteBatch.Draw(endTurnButton, GameState.mousePosition, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
}
#endregion
if (GameState.transitionTurn)
{
if (GameState.currentPlayer == player1)
{
spriteBatch.Draw(player1Transition, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw turn transition
}else if(GameState.currentPlayer == player2)
{
spriteBatch.Draw(player2Transition, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw turn transition
}
}
spriteBatch.End();
base.Draw(gameTime); // repeatedly calls draw
......
......@@ -57,18 +57,26 @@ namespace Model
Sets and gets whether an animation sequence is currently on screen
*/
public static bool isAnimating { get; set; }
/*
/**
Sets and gets whether game is over
*/
public static bool gameOver { get; set; }
/*
/**
Sets and gets if game should exit
*/
public static bool exitGameClicked { get; set; }
/*
Sets and gets current mouse click position
/**
Sets and gets end turn button position
*/
public static Vector2 endTurnButtonLocation { get; set; }
/**
Sets and gets current mouse click position
*/
public static Vector2 mousePosition { get; set; }
/**
sets and gets whether it is currently transitioning turns
*/
public static bool transitionTurn { get; set; }
/*
Sets and gets movable nodes that can be retrieved without calling path finding
*/
......
......@@ -51,7 +51,7 @@ namespace Controller
camera.Position = new Vector2(camera.Position.X + scrollSpeed, camera.Position.Y);
}
Debug.WriteLine(camera.Position.X);
//Debug.WriteLine(camera.Position.X);
// scroll map to the right
if (currentMouseState.X >= GameState.SCREEN_WIDTH && camera.Position.X > boundaryX)
......@@ -83,13 +83,15 @@ namespace Controller
GameState.unitToAttack = null;
GameState.attackConfirmOpen = false;
GameState.dropDownMenuOpen = false;
GameState.transitionTurn = true;
}
else if (lastMouseState.RightButton == ButtonState.Released
&& currentMouseState.RightButton == ButtonState.Pressed
&& validX && validY)
{
GameState.endTurnButton = true;
GameState.endTurnButtonLocation = new Vector2(currentMouseState.X, currentMouseState.Y);
GameState.endTurnButtonLocation = new Vector2(currentMouseState.X - camera.Position.X, currentMouseState.Y - camera.Position.Y);
GameState.mousePosition = new Vector2(currentMouseState.X, currentMouseState.Y);
}
// checks for single mouse left click inside the game window
......@@ -118,9 +120,12 @@ namespace Controller
GameState.enemyPlayer = (tempPlayer);
GameFunction.startTurn(GameState.currentPlayer);
GameState.endTurnButton = false;
GameState.transitionTurn = true;
Debug.WriteLine("Clicked");
}
else
{
Debug.WriteLine("Misclicked");
GameState.endTurnButton = false;
}
}
......
......@@ -360,6 +360,26 @@ namespace Blaze_Brigade {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap player1turn {
get {
object obj = ResourceManager.GetObject("player1turn", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap player2turn {
get {
object obj = ResourceManager.GetObject("player2turn", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
......
......@@ -220,4 +220,10 @@
<data name="End_Button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\End_Button.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="player1turn" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\player1turn.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="player2turn" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\player2turn.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
\ No newline at end of file
src/Blaze-Brigade/Blaze_Brigade/Resources/player1turn.png

321 KiB

src/Blaze-Brigade/Blaze_Brigade/Resources/player2turn.png

325 KiB

......@@ -289,6 +289,20 @@
<Processor>TextureProcessor</Processor>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="player1turn.png">
<Name>player1turn</Name>
<Importer>TextureImporter</Importer>
<Processor>TextureProcessor</Processor>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="player2turn.png">
<Name>player2turn</Name>
<Importer>TextureImporter</Importer>
<Processor>TextureProcessor</Processor>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment