Exemplo n.º 1
0
        public IItemSprite CreateCoin(Vector2 location)
        {
            IItemSprite sprite = new CoinSprite(coinTexture);

            sprite.DestinationRectangle = new Rectangle((int)location.X, (int)location.Y, coinTexture.Width, coinTexture.Height);
            return(sprite);
        }
Exemplo n.º 2
0
        public Sprite MakeProduct(int x)
        {
            sprite = (spriteType)x;

            sourceRect.Width = 16;
            sourceRect.X = 0;
            sourceRect.Y = 0;
            sourceRect.Height = 16;
            timePerFrame = 0;
            switch (sprite)
            {
                case spriteType.fireFlower:
                    {
                        sourceRect.Width = 64;
                        sourceRect.Height = 16;
                        sourceRect.X = 0;
                        sourceRect.Y = 32;
                        timePerFrame = 250;
                        numberOfFrames = 4;
                        Sprite fireFlower = new FlowerSprite(Vector2.Zero, texture, sourceRect, timePerFrame, numberOfFrames, true);
                        return fireFlower;
                    }
                case spriteType.superMushroom:
                    {
                        sourceRect.X = 0;
                        sourceRect.Y = 16;
                        sourceRect.Width = 16;
                        sourceRect.Height = 16;
                        Sprite superShroom = new MushroomSprite(Vector2.Zero, texture, sourceRect, timePerFrame, numberOfFrames, false);
                        return superShroom;
                    }
                case spriteType.star:
                    {
                        sourceRect.X = 0;
                        sourceRect.Y = 48;
                        sourceRect.Width = 64;
                        sourceRect.Height = 16;
                        timePerFrame = 250;
                        numberOfFrames = 4;
                        Sprite star = new StarSprite(Vector2.Zero, texture, sourceRect, timePerFrame, numberOfFrames, true);
                        return star;
                    }
                case spriteType.coin:
                    {
                        sourceRect.X = 0;
                        sourceRect.Y = 80;
                        sourceRect.Width = 64;
                        sourceRect.Height = 16;
                        timePerFrame = 250;
                        numberOfFrames = 4;
                        Sprite coin = new CoinSprite(Vector2.Zero, texture, sourceRect, timePerFrame, numberOfFrames, true);
                        return coin;
                    }
                default:
                    {
                        return null;
                    }
            }
        }