public void Aaction() { action = Action.attack; if (direction == Direction.right) { ActualAnimation = getAnimation("rightsword"); } if (direction == Direction.up) { ActualAnimation = getAnimation("upsword"); } if (direction == Direction.left) { ActualAnimation = getAnimation("leftsword"); } if (direction == Direction.down) { ActualAnimation = getAnimation("downsword"); } }
// } private void getCurrentAnim() { if (direction == Direction.down) ActualAnimation = getAnimation("stilldown"); if (direction == Direction.up) ActualAnimation = getAnimation("stillup"); if (direction == Direction.left) ActualAnimation = getAnimation("stillleft"); if (direction == Direction.right) ActualAnimation = getAnimation("stillright"); }
public void MoveUp(WorldScreen screen) { action = Action.walk; direction = Direction.up; ActualAnimation = getAnimation("runup"); if (!MoveCollision(new Vector2(position.X, position.Y - speed), screen)) { position.Y -= speed; } }
public void MoveRight(WorldScreen screen) { action = Action.walk; direction = Direction.right; ActualAnimation = getAnimation("runright"); if (!MoveCollision(new Vector2(position.X + speed, position.Y), screen)) { position.X += speed; } }
public void MoveLeft(WorldScreen screen) { action = Action.walk; direction = Direction.left; ActualAnimation = getAnimation("runleft"); if (!MoveCollision(new Vector2(position.X - speed, position.Y), screen)) { position.X -= speed; } }
public void MoveDown(WorldScreen screen) { action = Action.walk; direction = Direction.down; ActualAnimation = getAnimation("rundown"); if (!MoveCollision(new Vector2(position.X,position.Y+speed),screen )) { position.Y += speed; } }
public void LoadContent() { texture = ScreenManager.Instance.Content.Load<Texture2D>("player"); collisiontex = ScreenManager.Instance.Content.Load<Texture2D>("tileset/kind"); var anim1d = new Rectangle(0, 0, 15, 16); var anim2d = new Rectangle(0, 30, 15, 16); var rundownRectangles = new List<Rectangle>(); rundownRectangles.Add(anim1d); rundownRectangles.Add(anim2d); var rundown = new SpriteManager("rundown", texture, 200f, rundownRectangles); var anim1l = new Rectangle(30, 0, 15, 16); var anim2l = new Rectangle(30, 30, 15, 16); var runleftRectangles = new List<Rectangle>(); runleftRectangles.Add(anim1l); runleftRectangles.Add(anim2l); var runleft = new SpriteManager("runleft", texture, 200f, runleftRectangles); var anim1u = new Rectangle(60, 0, 15, 16); var anim2u = new Rectangle(60, 30, 15, 16); var runupRectangles = new List<Rectangle>(); runupRectangles.Add(anim1u); runupRectangles.Add(anim2u); var runup = new SpriteManager("runup", texture, 200f, runupRectangles); var anim1r = new Rectangle(90, 0, 15, 16); var anim2r = new Rectangle(90, 30, 15, 16); var runriRectangles = new List<Rectangle>(); runriRectangles.Add(anim1r); runriRectangles.Add(anim2r); var runright = new SpriteManager("runright", texture, 200f, runriRectangles); var dRectangles = new List<Rectangle>(); dRectangles.Add(new Rectangle(0, 0, 15, 16)); var stilldown = new SpriteManager("stilldown", texture, 200f, dRectangles); var lRectangles = new List<Rectangle>(); lRectangles.Add(new Rectangle(30, 0, 15, 16)); var stillleft = new SpriteManager("stillleft", texture, 200f, lRectangles); var uRectangles = new List<Rectangle>(); uRectangles.Add(new Rectangle(60, 0, 15, 16)); var stillup = new SpriteManager("stillup", texture, 200f, uRectangles); var rRectangles = new List<Rectangle>(); rRectangles.Add(new Rectangle(90, 0, 15, 16)); var stillright = new SpriteManager("stillright", texture, 200f, rRectangles); Animations = new List<SpriteManager>(); var sworddownrec = new List<Rectangle>(); sworddownrec.Add(new Rectangle(0, 60, 15, 16)); sworddownrec.Add(new Rectangle(0, 84, 16, 27)); var downsword = new SpriteManager("downsword", texture, 150f, sworddownrec); var swordleftnrec = new List<bigsprite>(); swordleftnrec.Add(new bigsprite(new Rectangle(30,60,16,15),new Vector2(0,0))); swordleftnrec.Add(new bigsprite(new Rectangle(24, 90, 27, 15),new Vector2(-11,0))); var leftsword = new SpriteManager("leftsword",texture,150f,swordleftnrec); var sworduprec = new List<bigsprite>(); sworduprec.Add(new bigsprite(new Rectangle(60,60,16,16),new Vector2(0,0))); sworduprec.Add(new bigsprite(new Rectangle(60, 84, 16, 28),new Vector2(0,-11))); var upsword = new SpriteManager("upsword", texture, 150f, sworduprec); var swordrightrec = new List<Rectangle>(); swordrightrec.Add(new Rectangle(90, 60, 15, 16)); swordrightrec.Add(new Rectangle(84,90,27,15)); var rightsword = new SpriteManager("rightsword", texture, 150f, swordrightrec); Animations.Add(rightsword); Animations.Add(upsword); Animations.Add(downsword); Animations.Add(leftsword); Animations.Add(rundown); Animations.Add(runleft); Animations.Add(runup); Animations.Add(runright); Animations.Add(stilldown); Animations.Add(stillleft); Animations.Add(stillup); Animations.Add(stillright); ActualAnimation = getAnimation("stilldown"); }