public void PlayAnimation(Animation animation)
        {
            if (Animation == animation)
                return;

            this.animation = animation;
            this.frameIndex = 0;
            this.time = 0.0f;
        }
Beispiel #2
0
        public Coin(Texture2D texture2D, Vector2 position)
        {
            coin = new Animation(texture2D, 0.1f, true);
            Position = position;
            sprite.PlayAnimation(coin);

            int width = (int)(coin.FrameWidth * 0.35);
            int left = (coin.FrameWidth - width) / 2;
            int height = (int)(coin.FrameWidth * 0.7);
            int top = coin.FrameHeight - height;
            localBounds = new Rectangle(left, top, width, height);
        }