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;
24 private Vector2 position;
25 private SpriteBatch character;
28 public void Update(TimeSpan timeSpan)
30 SpriteTexture.UpdateFrame(timeSpan);
33 public AnimateMelee(ContentManager content, Player player)
35 SpriteTexture = new AnimatedTexture(Vector2.Zero, 0, 1.0f, 0.5f);
36 contentManager = content;
38 position = Vector2.Zero;
40 changedGraphic = true;
46 public void AttackLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
50 changedGraphic = false;
52 changedGraphic = true;
54 //graphics = graphicsDeviceManager;
55 //this.spriteBatch = spriteBatch;
56 //character = new SpriteBatch(spriteBatch.GraphicsDevice);
57 character = spriteBatch;
61 // SpriteTexture.Load(graphics.GraphicsDevice, contentManager, "fileNames[0]", 8, 12, true, 1);
64 public void Animate(Vector2 drawSpot)
66 //character = new SpriteBatch(graphics.GraphicsDevice);
67 // "character" is the name of the sprite asset in the project.
68 Console.WriteLine(ph);
70 SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1);
71 //viewport = graphics.GraphicsDevice.Viewport;
72 position = new Vector2(Player.Coordinates.X*Map.PixelsToUnitSquares, Player.Coordinates.Y*Map.PixelsToUnitSquares);//viewport.Width / 2, 0);//viewport.Height / 2f);
73 Console.WriteLine(drawSpot);
75 SpriteTexture.DrawFrame(character, drawSpot);