2 using System.Collections.Generic;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework.Graphics;
7 using Microsoft.Xna.Framework.Content;
15 private AnimatedTexture SpriteTexture;
16 string[] fileNames = new string[] { "graphics/meleeAttack", "graphics/meleeDying",
17 "graphics/meleeExplosion", "graphics/meleeStanding", "graphics/meleeWalking" };
18 private ContentManager contentManager;
19 //private GraphicsDeviceManager graphics;
20 //private SpriteBatch spriteBatch;
21 private bool changedGraphic;
22 private string lastPh;
25 private Vector2 position;
26 private SpriteBatch character;
29 public void Update(TimeSpan timeSpan)
31 SpriteTexture.UpdateFrame(timeSpan);
34 public AnimateMelee(ContentManager content, Player player)
36 SpriteTexture = new AnimatedTexture(Vector2.Zero, 0, 1.0f, 0.5f);
37 contentManager = content;
39 position = Vector2.Zero;
41 changedGraphic = true;
47 public void AttackDown(SpriteBatch spriteBatch, Vector2 drawSpot)
51 character = spriteBatch;
55 public void AttackDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
59 character = spriteBatch;
63 public void AttackLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
68 changedGraphic = false;
70 changedGraphic = true;
72 //graphics = graphicsDeviceManager;
73 //this.spriteBatch = spriteBatch;
74 //character = new SpriteBatch(spriteBatch.GraphicsDevice);
75 character = spriteBatch;
79 public void AttackUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
83 character = spriteBatch;
87 public void AttackUp(SpriteBatch spriteBatch, Vector2 drawSpot)
91 character = spriteBatch;
95 public void AttackUpRight(SpriteBatch spriteBatch, Vector2 drawSpot)
99 character = spriteBatch;
103 public void AttackRight(SpriteBatch spriteBatch, Vector2 drawSpot)
107 character = spriteBatch;
111 public void AttackDownRight(SpriteBatch spriteBatch, Vector2 drawSpot)
115 character = spriteBatch;
121 public void DieDown(SpriteBatch spriteBatch, Vector2 drawSpot)
125 character = spriteBatch;
129 public void DieDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
133 character = spriteBatch;
137 public void DieLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
141 character = spriteBatch;
145 public void DieUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
149 character = spriteBatch;
153 public void DieUp(SpriteBatch spriteBatch, Vector2 drawSpot)
157 character = spriteBatch;
161 public void DieUpRight(SpriteBatch spriteBatch, Vector2 drawSpot)
165 character = spriteBatch;
169 public void DieRight(SpriteBatch spriteBatch, Vector2 drawSpot)
173 character = spriteBatch;
177 public void DieDownRight(SpriteBatch spriteBatch, Vector2 drawSpot)
181 character = spriteBatch;
186 public void ExplodeDown(SpriteBatch spriteBatch, Vector2 drawSpot)
190 character = spriteBatch;
194 public void ExplodeDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
198 character = spriteBatch;
202 public void ExplodeLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
206 character = spriteBatch;
210 public void ExplodeUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
214 character = spriteBatch;
218 public void ExplodeUp(SpriteBatch spriteBatch, Vector2 drawSpot)
222 character = spriteBatch;
226 public void ExplodeUpRight(SpriteBatch spriteBatch, Vector2 drawSpot)
230 character = spriteBatch;
234 public void ExplodeRight(SpriteBatch spriteBatch, Vector2 drawSpot)
238 character = spriteBatch;
242 public void ExplodeDownRight(SpriteBatch spriteBatch, Vector2 drawSpot)
246 character = spriteBatch;
253 * change this from standard animation to only take into account one frame
255 public void StandDown(SpriteBatch spriteBatch, Vector2 drawSpot)
259 character = spriteBatch;
263 public void StandDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
267 character = spriteBatch;
271 public void StandLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
275 character = spriteBatch;
279 public void StandUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
283 character = spriteBatch;
287 public void StandUp(SpriteBatch spriteBatch, Vector2 drawSpot)
291 character = spriteBatch;
295 public void StandUpRight(SpriteBatch spriteBatch, Vector2 drawSpot)
299 character = spriteBatch;
303 public void StandRight(SpriteBatch spriteBatch, Vector2 drawSpot)
307 character = spriteBatch;
311 public void StandDownRight(SpriteBatch spriteBatch, Vector2 drawSpot)
315 character = spriteBatch;
321 public void WalkDown(SpriteBatch spriteBatch, Vector2 drawSpot)
325 character = spriteBatch;
329 public void WalkDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
333 character = spriteBatch;
337 public void WalkLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
341 character = spriteBatch;
345 public void WalkUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
349 character = spriteBatch;
353 public void WalkUp(SpriteBatch spriteBatch, Vector2 drawSpot)
357 character = spriteBatch;
361 public void WalkUpRight(SpriteBatch spriteBatch, Vector2 drawSpot)
365 character = spriteBatch;
369 public void WalkRight(SpriteBatch spriteBatch, Vector2 drawSpot)
373 character = spriteBatch;
377 public void WalkDownRight(SpriteBatch spriteBatch, Vector2 drawSpot)
381 character = spriteBatch;
388 public void Animate(Vector2 drawSpot)
390 //character = new SpriteBatch(graphics.GraphicsDevice);
391 // "character" is the name of the sprite asset in the project.
392 Console.WriteLine(ph);
393 //SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, row);
396 SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, false, 1);
398 //viewport = graphics.GraphicsDevice.Viewport;
399 position = new Vector2(Player.Coordinates.X*Map.PixelsToUnitSquares, Player.Coordinates.Y*Map.PixelsToUnitSquares);//viewport.Width / 2, 0);//viewport.Height / 2f);
400 Console.WriteLine(drawSpot);
402 SpriteTexture.DrawFrame(character, drawSpot);