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

Dead units no longer counter attack. Added game over button and overlay....

Dead units no longer counter attack. Added game over button and overlay. Button event to be implemented
parent 0c23cb29
No related branches found
No related tags found
No related merge requests found
Showing
with 60 additions and 17 deletions
......@@ -122,6 +122,7 @@
<Content Include="GameThumbnail.png">
<XnaPlatformSpecific>true</XnaPlatformSpecific>
</Content>
<None Include="Resources\main_menu_button.png" />
<None Include="Resources\warrior_stats.png" />
<None Include="Resources\mage_stats.png" />
<None Include="Resources\2warrior_stats.png" />
......
......@@ -6,10 +6,10 @@ Content\attack.xnb
Content\items.xnb
Content\move.xnb
Content\wait.xnb
Content\PixelFont.xnb
Content\warrior_stats.xnb
Content\PixelFontLarge.xnb
Content\warrior.xnb
Content\PixelFont.xnb
Content\PixelFontLarge.xnb
Content\instructions1.xnb
Content\instructions2.xnb
Content\instructions3.xnb
......@@ -32,3 +32,4 @@ Content\warrior_attack.xnb
Content\attack_confirm.xnb
Content\confirm_attack.xnb
Content\PixelFontLargest.xnb
Content\main_menu_button.xnb
......@@ -27,7 +27,7 @@ namespace Model
*/
public BronzeSword()
{
modStr = 5;
modStr = 50;
modSkill = 5;
modInt = 0;
range = new int[2] { 1, 1 };
......
......@@ -48,7 +48,7 @@ namespace Controller
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D backGround, moveableNode, attackableNode;
Texture2D backGround, moveableNode, attackableNode, gameOver;
private SpriteFont font; // custom font
private SpriteFont largeFont; // custom font 2
private SpriteFont largestFont; // custom font 3
......@@ -94,6 +94,7 @@ namespace Controller
backGround = Content.Load<Texture2D>("Game_Map"); // load background
moveableNode = Content.Load<Texture2D>("moveableNode");
attackableNode = Content.Load<Texture2D>("attackableNode");
gameOver = Content.Load<Texture2D>("main_menu_button");
font = Content.Load<SpriteFont>("PixelFont"); //loads font PixelFont
largeFont = Content.Load<SpriteFont>("PixelFontLarge"); //loads font PixelFont
......@@ -151,8 +152,8 @@ namespace Controller
mMenu.Show(); // show main menu
if (mMenu.start == true) //if New game is selected
{
mMenu.Close(); //close Main Menu screen
tut.Close(); //close How To Play Menu
mMenu.Hide(); //close Main Menu screen
tut.Hide(); //close How To Play Menu
Form GameForm = (Form)Form.FromHandle(Window.Handle);
GameForm.Opacity = 100; // make screen show
currentGameState = GameMenuState.Playing; //set game state to Playing
......@@ -222,8 +223,6 @@ namespace Controller
case GameMenuState.Playing: // if true.. load new image...
backGround = Content.Load<Texture2D>("Game_Map"); // load background
Debug.WriteLine(player1.getNumOfUnits());
if (GameFunction.isTurnOver())
......@@ -240,8 +239,7 @@ namespace Controller
GameFunction.removeDeceasedUnit(graph, player1, unit);
if (GameFunction.isGameOver(player1, player2))
{
// TODO: game over screen
Debug.WriteLine("Game is over.");
GameState.gameOver = true;
break;
}
}
......@@ -252,8 +250,7 @@ namespace Controller
GameFunction.removeDeceasedUnit(graph, player2, unit);
if (GameFunction.isGameOver(player1, player2))
{
// TODO: game over screen
Debug.WriteLine("Game is over.");
GameState.gameOver = true;
break;
}
}
......@@ -464,9 +461,18 @@ namespace Controller
}
#endregion
if (GameState.gameOver)
{
Debug.WriteLine("game over");
Vector2 gameOverLocation = new Vector2(-370, -300);
spriteBatch.DrawString(largestFont,"Game Over", new Vector2(350, 200), Color.DarkRed, 0, Vector2.Zero, 1f, SpriteEffects.None, 0f); //draws Game Over Text
spriteBatch.Draw(gameOver, Vector2.Zero, null, Color.White, 0, gameOverLocation, 1f, SpriteEffects.None, 0f);
}
spriteBatch.Draw(backGround, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 1);
break;
}
......
......@@ -49,6 +49,10 @@ namespace Model
*/
public static bool isAnimating { get; set; }
/*
Sets and gets whether game is over
*/
public static bool gameOver { get; set; }
/*
Sets and gets movable nodes that can be retrieved without calling path finding
*/
public static LinkedList<Node> moveableNodes { get; set; }
......
......@@ -64,6 +64,14 @@ namespace Controller
Vector2 mouseClickCoordinates = new Vector2(currentMouseState.X, currentMouseState.Y); // mouse click coordinates
Node nodeClickedOn = graph.getNode(mouseClickCoordinates);
if (GameState.gameOver)
{
if ((mouseClickCoordinates.X > 370 & mouseClickCoordinates.X < 556) & (mouseClickCoordinates.Y>300&mouseClickCoordinates.Y<396)){
}
}
#region Check if a unit is clicked
// if player clicks after unit is already selected ...
......@@ -391,11 +399,14 @@ namespace Controller
attackAnimation(attackDirection, unit);
int damageDealt = DamageCalculations.finalDamage(unit, unit2, false);
Thread.Sleep(750);
attackAnimation(counterAttackDirection, unit2);
int damageTaken = DamageCalculations.finalDamage(unit2, unit, false);
unit2.Hp = unit2.Hp - damageDealt;
unit.Hp = unit.Hp - damageTaken;
if (unit2.Alive) //if unit 2 is still alive, perform a counter attack
{
Thread.Sleep(750);
attackAnimation(counterAttackDirection, unit2);
int damageTaken = DamageCalculations.finalDamage(unit2, unit, false);
unit.Hp = unit.Hp - damageTaken;
}
GameState.attackConfirmOpen = false;
setSelectedUnit(null, false);
turnState = TurnState.Wait;
......
......@@ -300,6 +300,16 @@ namespace Blaze_Brigade {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap main_menu_button {
get {
object obj = ResourceManager.GetObject("main_menu_button", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
......
......@@ -211,4 +211,7 @@
<data name="_2warrior_stats" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\2warrior_stats.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="main_menu_button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\main_menu_button.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/main_menu_button.png

3.21 KiB

......@@ -268,6 +268,13 @@
<Processor>FontDescriptionProcessor</Processor>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="main_menu_button.png">
<Name>main_menu_button</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.
......
src/Blaze-Brigade/Blaze_BrigadeContent/main_menu_button.png

3.21 KiB

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