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/Ralph"); idleAnimation = new Animation(player, 0.1f, true); int positionX = (Level.windowWidth/2) - (player.Width /8); int positionY = (Level.windowHeight / 2) - (player.Height / 3); playerPosition = new Vector2((float)positionX, (float)positionY); spritePlayer.PlayAnimation(idleAnimation); }