X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FAnimateMelee.cs;h=613c594a4f3a010cbb7dea44fb67b4dcbef0a7c2;hp=e114dbed0dbc30254ac2f636bec3724bab6d28a0;hb=2079dadac9b317d61015a9e37eefc9aca761c1ad;hpb=e8ee0aa62a7e8b5dffa9e02c00c3e353a9e93b4c diff --git a/CarFire/CarFire/CarFire/AnimateMelee.cs b/CarFire/CarFire/CarFire/AnimateMelee.cs index e114dbe..613c594 100644 --- a/CarFire/CarFire/CarFire/AnimateMelee.cs +++ b/CarFire/CarFire/CarFire/AnimateMelee.cs @@ -18,48 +18,389 @@ namespace CarFire private ContentManager contentManager; //private GraphicsDeviceManager graphics; //private SpriteBatch spriteBatch; - + private bool changedGraphic; + private string lastPh; + private int row; private string ph; private Vector2 position; private SpriteBatch character; - + Player Player; + + public void Update(TimeSpan timeSpan) + { + SpriteTexture.UpdateFrame(timeSpan); + } //constructor(s) - public AnimateMelee(ContentManager content) + public AnimateMelee(ContentManager content, Player player) { SpriteTexture = new AnimatedTexture(Vector2.Zero, 0, 1.0f, 0.5f); contentManager = content; ph = fileNames[3]; position = Vector2.Zero; + Player = player; + changedGraphic = true; + } //methods - public void AttackLeft(SpriteBatch spriteBatch) + public void AttackDown(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[0]; + row = 0; + character = spriteBatch; + Animate(drawSpot); + } + + public void AttackDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[0]; + row = 1; + character = spriteBatch; + Animate(drawSpot); + } + + public void AttackLeft(SpriteBatch spriteBatch, Vector2 drawSpot) { ph = fileNames[0]; + row = 2; + if (lastPh == ph) + changedGraphic = false; + else + changedGraphic = true; + lastPh = ph; //graphics = graphicsDeviceManager; //this.spriteBatch = spriteBatch; - //spriteBatch. + //character = new SpriteBatch(spriteBatch.GraphicsDevice); + character = spriteBatch; + Animate(drawSpot); + } + + public void AttackUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[0]; + row = 4; + character = spriteBatch; + Animate(drawSpot); + } + + public void AttackUp(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[0]; + row = 4; + character = spriteBatch; + Animate(drawSpot); + } + + public void AttackUpRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[0]; + row = 5; + character = spriteBatch; + Animate(drawSpot); + } + + public void AttackRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[0]; + row = 6; + character = spriteBatch; + Animate(drawSpot); + } + + public void AttackDownRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[0]; + row = 7; + character = spriteBatch; + Animate(drawSpot); + } + + // death + + public void DieDown(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[1]; + row = 0; + character = spriteBatch; + Animate(drawSpot); + } + + public void DieDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[1]; + row = 1; + character = spriteBatch; + Animate(drawSpot); + } + + public void DieLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[1]; + row = 2; + character = spriteBatch; + Animate(drawSpot); + } + + public void DieUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[1]; + row = 4; + character = spriteBatch; + Animate(drawSpot); + } + + public void DieUp(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[1]; + row = 4; + character = spriteBatch; + Animate(drawSpot); + } + + public void DieUpRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[1]; + row = 5; + character = spriteBatch; + Animate(drawSpot); + } + + public void DieRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[1]; + row = 6; + character = spriteBatch; + Animate(drawSpot); + } + + public void DieDownRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[1]; + row = 7; + character = spriteBatch; + Animate(drawSpot); + } + + //melee explosion + public void ExplodeDown(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[2]; + row = 0; + character = spriteBatch; + Animate(drawSpot); + } + + public void ExplodeDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[2]; + row = 1; + character = spriteBatch; + Animate(drawSpot); + } + + public void ExplodeLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[2]; + row = 2; + character = spriteBatch; + Animate(drawSpot); + } + + public void ExplodeUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[2]; + row = 4; + character = spriteBatch; + Animate(drawSpot); + } - character = new SpriteBatch(spriteBatch.GraphicsDevice); - Animate(); + public void ExplodeUp(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[2]; + row = 4; + character = spriteBatch; + Animate(drawSpot); + } + + public void ExplodeUpRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[2]; + row = 5; + character = spriteBatch; + Animate(drawSpot); + } + + public void ExplodeRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[2]; + row = 6; + character = spriteBatch; + Animate(drawSpot); + } + + public void ExplodeDownRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[2]; + row = 7; + character = spriteBatch; + Animate(drawSpot); + } + + //melee standing + /* + * to do + * change this from standard animation to only take into account one frame + */ + public void StandDown(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[3]; + row = 0; + character = spriteBatch; + Animate(drawSpot); + } + + public void StandDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[3]; + row = 1; + character = spriteBatch; + Animate(drawSpot); + } + + public void StandLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[3]; + row = 2; + character = spriteBatch; + Animate(drawSpot); + } + + public void StandUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[3]; + row = 4; + character = spriteBatch; + Animate(drawSpot); + } + + public void StandUp(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[3]; + row = 4; + character = spriteBatch; + Animate(drawSpot); + } + + public void StandUpRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[3]; + row = 5; + character = spriteBatch; + Animate(drawSpot); + } + public void StandRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[3]; + row = 6; + character = spriteBatch; + Animate(drawSpot); + } + + public void StandDownRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[3]; + row = 7; + character = spriteBatch; + Animate(drawSpot); + } + + //walking + + public void WalkDown(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[4]; + row = 0; + character = spriteBatch; + Animate(drawSpot); + } + + public void WalkDownLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[4]; + row = 1; + character = spriteBatch; + Animate(drawSpot); + } - // SpriteTexture.Load(graphics.GraphicsDevice, contentManager, "fileNames[0]", 8, 12, true, 1); + public void WalkLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[4]; + row = 2; + character = spriteBatch; + Animate(drawSpot); + } + + public void WalkUpLeft(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[4]; + row = 4; + character = spriteBatch; + Animate(drawSpot); } - public void Animate() + public void WalkUp(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[4]; + row = 4; + character = spriteBatch; + Animate(drawSpot); + } + + public void WalkUpRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[4]; + row = 5; + character = spriteBatch; + Animate(drawSpot); + } + + public void WalkRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[4]; + row = 6; + character = spriteBatch; + Animate(drawSpot); + } + + public void WalkDownRight(SpriteBatch spriteBatch, Vector2 drawSpot) + { + ph = fileNames[4]; + row = 7; + character = spriteBatch; + Animate(drawSpot); + } + + + + + public void Animate(Vector2 drawSpot) { //character = new SpriteBatch(graphics.GraphicsDevice); // "character" is the name of the sprite asset in the project. Console.WriteLine(ph); - SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1); - //viewport = graphics.GraphicsDevice.Viewport; - position = new Vector2(0, 0);//viewport.Width / 2, 0);//viewport.Height / 2f); + //SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, row); + + if(changedGraphic) + SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1); - character.Begin(); - SpriteTexture.DrawFrame(character, position); - character.End(); + //viewport = graphics.GraphicsDevice.Viewport; + position = new Vector2(Player.Coordinates.X*Map.PixelsToUnitSquares, Player.Coordinates.Y*Map.PixelsToUnitSquares);//viewport.Width / 2, 0);//viewport.Height / 2f); + Console.WriteLine(drawSpot); + //character.Begin(); + SpriteTexture.DrawFrame(character, drawSpot); + //character.End(); } }