public void PlayAnimation(Animation animation) { if (Animation == animation) { return; } this.animation = animation; this.frameIndex = 0; this.time = 0.0f; }
public void LoadContent() { player = content.Load<Texture2D>("HeroSprite/buu-idle"); attackAnimation = new Animation(player, 0.1f, true, 7); int positionX = (Level.windowWidth / 2) - (attackAnimation.FrameWidth); int positionY = (Level.windowHeight / 2) - (attackAnimation.FrameHeight); playerPosition = new Vector2((float)positionX, (float)positionY); spritePlayer.PlayAnimation(attackAnimation); }
public void AttackUpdate(GameTime gameTime) { player = content.Load<Texture2D>("HeroSprite/buu-attack"); attackAnimation = new Animation(player, 0.1f, false, 7); int positionX = (Level.windowWidth / 2) - (attackAnimation.FrameWidth); int positionY = (Level.windowHeight / 2) - (attackAnimation.FrameHeight); playerPosition = new Vector2((float)positionX, (float)positionY); spritePlayer.PlayAnimation(attackAnimation); }
public void AttackUpdate(GameTime gameTime) { if (hurtAnima == 1) { player = content.Load<Texture2D>("HeroSprite/Goku Attack 2"); attackAnimation = new Animation(player, 0.1f, false, 6); int positionX = (Level.windowWidth - 600) - (attackAnimation.FrameWidth); int positionY = (Level.windowHeight / 2) - (attackAnimation.FrameHeight); playerPosition = new Vector2((float)positionX, (float)positionY); spritePlayer.PlayAnimation(attackAnimation); hurtAnima = 0; } if (hurtAnima == 0) { player = content.Load<Texture2D>("HeroSprite/Goku Attack 2"); attackAnimation = new Animation(player, 0.1f, false, 6); int positionX = (Level.windowWidth - 600) - (attackAnimation.FrameWidth); int positionY = (Level.windowHeight / 2) - (attackAnimation.FrameHeight); playerPosition = new Vector2((float)positionX, (float)positionY); spritePlayer.PlayAnimation(attackAnimation); hurtAnima = 1; } if (hurtAnima == 0 || hurtAnima == 1 && Level.damageNumber == 40) { player = content.Load<Texture2D>("HeroSprite/goku Victory"); attackAnimation = new Animation(player, 0.1f, false, 2); int positionX = (Level.windowWidth - 600) - (attackAnimation.FrameWidth); int positionY = (Level.windowHeight / 2) - (attackAnimation.FrameHeight); playerPosition = new Vector2((float)positionX, (float)positionY); spritePlayer.PlayAnimation(attackAnimation); hurtAnima = 1; } }
public void IdleUpdate(GameTime gameTime) { player = content.Load<Texture2D>("HeroSprite/Goku Attack 2"); attackAnimation = new Animation(player, 0.1f, true, 6); int positionX = (Level.windowWidth - 600 ) - (attackAnimation.FrameWidth); int positionY = (Level.windowHeight / 2) - (attackAnimation.FrameHeight); playerPosition = new Vector2((float)positionX, (float)positionY); spritePlayer.PlayAnimation(attackAnimation); }