public void Update(GameTime gameTime, Joystick input) { position.X += input.X * speed; position.Y -= input.Y * speed; if (input.Left && input.Up) { currentAnimation = (Animation)playerAnimation["leftup"]; position.X -= speed; position.Y -= speed; } else if (input.Left && input.Down) { currentAnimation = (Animation)playerAnimation["leftdown"]; position.X -= speed; position.Y += speed; } else if (input.Right && input.Down) { currentAnimation = (Animation)playerAnimation["rightdown"]; position.X += speed; position.Y += speed; } else if (input.Right && input.Up) { currentAnimation = (Animation)playerAnimation["rightup"]; position.X += speed; position.Y -= speed; } else if (input.Left) { currentAnimation = (Animation)playerAnimation["left"]; position.X -= speed; } else if (input.Right) { currentAnimation = (Animation)playerAnimation["right"]; position.X += speed; } else if (input.Up) { currentAnimation = (Animation)playerAnimation["up"]; position.Y -= speed; } else if (input.Down) { currentAnimation = (Animation)playerAnimation["down"]; position.Y += speed; } else { } currentAnimation.Position = position; currentAnimation.Update(gameTime); }
public void Initialize(Animation animation, Vector2 location) { currentAnimation = animation; position = location; }
public void Initialize(Vector2 location, SpriteSheet sheet) { LoadAnimations(sheet); currentAnimation = playerAnimation["down"]; position = location; }
public void AddAnimation(String key, Animation a) { playerAnimation.Add(key, a); }