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

Added attack info screen to attacking

parent 6b9de933
No related branches found
No related tags found
No related merge requests found
......@@ -26,3 +26,6 @@ Content\2mage_stats.xnb
Content\2warrior.xnb
Content\2warrior_attack.xnb
Content\2warrior_stats.xnb
Content\archer_attack.xnb
Content\mage_attack.xnb
Content\warrior_attack.xnb
......@@ -220,7 +220,6 @@ namespace Controller
break;
}
#endregion
base.Update(gameTime); // repeatedly calls update
}
......@@ -305,8 +304,16 @@ namespace Controller
}
}
MenuButton confirmButton = unit.getAttackConfirmButton();
Vector2 attackInfoLocation2 = new Vector2(519, 0);
if (GameState.attackConfirmOpen)
{
if (GameState.currentPlayer == player1)
{
spriteBatch.Draw(unit.getCharAttackInfo(), Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground texture
}else
{
spriteBatch.Draw(unit.getCharAttackInfo(), attackInfoLocation2, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground texture
}
spriteBatch.Draw(confirmButton.getImage(), confirmButton.getPixelCoordinates(), null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0f);
}
#endregion
......@@ -373,7 +380,7 @@ namespace Controller
if (unitType == UnitType.Warrior)
{
Unit unit = new Warrior(Content.Load<Texture2D>("warrior"), attackButton, moveButton,
itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("warrior_stats"), unitPosition, 1);
itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("warrior_stats"), Content.Load<Texture2D>("warrior_attack"), unitPosition, 1);
graph.getNode(unitPosition).unitOnNode = (unit);
return unit;
}
......@@ -383,7 +390,7 @@ namespace Controller
if (unitType == UnitType.Warrior)
{
Unit unit = new Warrior(Content.Load<Texture2D>("2warrior"), attackButton, moveButton,
itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("2warrior_stats"), unitPosition, 2);
itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("2warrior_stats"), Content.Load<Texture2D>("2warrior_attack"), unitPosition, 2);
graph.getNode(unitPosition).unitOnNode = (unit);
return unit;
}
......
......@@ -58,7 +58,7 @@ namespace Controller
if (getMenuButtonClicked(mouseClickCoordinates) != null)
{
MenuButton menuButton = getMenuButtonClicked(mouseClickCoordinates);
Debug.WriteLine(getMenuButtonClicked(mouseClickCoordinates).getButtonType());
//Debug.WriteLine(getMenuButtonClicked(mouseClickCoordinates).getButtonType());
buttonAction(menuButton);
return;
}
......@@ -184,7 +184,6 @@ namespace Controller
Game.Instance.Tick();
Thread.Sleep(10);
}
Debug.WriteLine(unit.PixelCoordinates.X);
}
#endregion
#region Attack Left
......@@ -356,7 +355,6 @@ namespace Controller
{
attackDirection = 3;
}
Debug.WriteLine(attackDirection);
attackAnimation(attackDirection);
GameState.attackConfirmOpen = false;
GameState.dropDownMenuOpen = true;
......
......@@ -37,6 +37,7 @@ namespace Model
Texture2D getSpriteImage(); // returns the sprite image of the unit
Texture2D getButtonImage(MenuButtonType buttonType); // returns the button texture at index i
Texture2D getCharInfo(); // returns the char info screen texture
Texture2D getCharAttackInfo(); // returns the char attack info screen texture
Tuple<int, int> Position { get; set;} // gets and sets unit's position by tile
Vector2 PixelCoordinates { get; set; }
MenuButton getMenuButtonAt(int i);
......
......@@ -29,12 +29,12 @@ namespace Model
private Tuple<int, int> position;
private MenuButton[] menuButtons = new MenuButton[4];
private MenuButton attackConfirm;
private Texture2D charInfo;
private Texture2D charInfo, charAttackInfo;
private int currentFrame; //the current frame the sprite is on
private int player; // which player this unit belongs to
public Warrior(Texture2D spriteImage, MenuButton attackButton, MenuButton moveButton,
MenuButton itemButton, MenuButton waitButton, MenuButton confirmButton, Texture2D charInfo, Vector2 coordinates, int player)
MenuButton itemButton, MenuButton waitButton, MenuButton confirmButton, Texture2D charInfo, Texture2D charAttackInfo, Vector2 coordinates, int player)
{
this.spriteImage = spriteImage;
menuButtons[0] = attackButton;
......@@ -43,6 +43,7 @@ namespace Model
menuButtons[3] = waitButton;
attackConfirm = confirmButton;
this.charInfo = charInfo;
this.charAttackInfo = charAttackInfo;
this.player = player;
pixelCoordinates = coordinates;
int positionX = (int)Math.Round(coordinates.X / 32);
......@@ -151,6 +152,11 @@ namespace Model
return charInfo;
}
public Texture2D getCharAttackInfo()
{
return charAttackInfo;
}
public Tuple<int, int> Position
{
get
......
......@@ -226,6 +226,27 @@
<Processor>TextureProcessor</Processor>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="archer_attack.png">
<Name>archer_attack</Name>
<Importer>TextureImporter</Importer>
<Processor>TextureProcessor</Processor>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="mage_attack.png">
<Name>mage_attack</Name>
<Importer>TextureImporter</Importer>
<Processor>TextureProcessor</Processor>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="warrior_attack.png">
<Name>warrior_attack</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/archer_attack.png

152 KiB

src/Blaze-Brigade/Blaze_BrigadeContent/mage_attack.png

160 KiB

src/Blaze-Brigade/Blaze_BrigadeContent/warrior_attack.png

172 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