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;
23 private Vector2 position;
24 private SpriteBatch character;
28 public AnimateMelee(ContentManager content, Player player)
30 SpriteTexture = new AnimatedTexture(Vector2.Zero, 0, 1.0f, 0.5f);
31 contentManager = content;
33 position = Vector2.Zero;
40 public void AttackLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
43 //graphics = graphicsDeviceManager;
44 //this.spriteBatch = spriteBatch;
46 //character = new SpriteBatch(spriteBatch.GraphicsDevice);
47 character = spriteBatch;
51 // SpriteTexture.Load(graphics.GraphicsDevice, contentManager, "fileNames[0]", 8, 12, true, 1);
54 public void Animate(Vector2 drawSpot)
56 //character = new SpriteBatch(graphics.GraphicsDevice);
57 // "character" is the name of the sprite asset in the project.
58 Console.WriteLine(ph);
59 SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1);
60 //viewport = graphics.GraphicsDevice.Viewport;
61 position = new Vector2(Player.Coordinates.X*Map.PixelsToUnitSquares, Player.Coordinates.Y*Map.PixelsToUnitSquares);//viewport.Width / 2, 0);//viewport.Height / 2f);
62 Console.WriteLine(drawSpot);
64 SpriteTexture.DrawFrame(character, drawSpot);