private ContentManager contentManager;\r
//private GraphicsDeviceManager graphics;\r
//private SpriteBatch spriteBatch;\r
-\r
+ private bool changedGraphic;\r
+ private string lastPh;\r
private string ph;\r
private Vector2 position;\r
private SpriteBatch character;\r
Player Player;\r
-\r
+ \r
+ public void Update(TimeSpan timeSpan)\r
+ {\r
+ SpriteTexture.UpdateFrame(timeSpan);\r
+ }\r
//constructor(s)\r
public AnimateMelee(ContentManager content, Player player)\r
{\r
ph = fileNames[3];\r
position = Vector2.Zero;\r
Player = player;\r
+ changedGraphic = true;\r
\r
}\r
\r
public void AttackLeft(SpriteBatch spriteBatch, Vector2 drawSpot)\r
{\r
ph = fileNames[0];\r
+ if (lastPh == ph)\r
+ changedGraphic = false;\r
+ else\r
+ changedGraphic = true;\r
+ lastPh = ph;\r
//graphics = graphicsDeviceManager;\r
//this.spriteBatch = spriteBatch;\r
- //spriteBatch.\r
//character = new SpriteBatch(spriteBatch.GraphicsDevice);\r
character = spriteBatch;\r
Animate(drawSpot);\r
//character = new SpriteBatch(graphics.GraphicsDevice);\r
// "character" is the name of the sprite asset in the project.\r
Console.WriteLine(ph);\r
- SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1);\r
+ if(changedGraphic)\r
+ SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1);\r
//viewport = graphics.GraphicsDevice.Viewport;\r
position = new Vector2(Player.Coordinates.X*Map.PixelsToUnitSquares, Player.Coordinates.Y*Map.PixelsToUnitSquares);//viewport.Width / 2, 0);//viewport.Height / 2f);\r
Console.WriteLine(drawSpot);\r