Пример #1
0
        public IItemSprite CreateStar(Vector2 location)
        {
            IItemSprite sprite = new StarSprite(starTexture, 4);

            sprite.DestinationRectangle = new Rectangle((int)location.X, (int)location.Y, starTexture.Width, starTexture.Height);
            return(sprite);
        }
Пример #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;
                    }
            }
        }