public IItemSprite CreateOneUp(Vector2 location) { IItemSprite sprite = new OneUpSprite(oneUpTexture); sprite.DestinationRectangle = new Rectangle((int)location.X, (int)location.Y, oneUpTexture.Width, oneUpTexture.Height); return(sprite); }
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(game.scene, 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(game.scene, Vector2.Zero, texture, sourceRect, timePerFrame, numberOfFrames, false); game.scene.MovSprites.Add(superShroom); 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(game.scene, Vector2.Zero, texture, sourceRect, timePerFrame, numberOfFrames, true); return star; } case spriteType.coin: { sourceRect.X = 0; sourceRect.Y = 82; sourceRect.Width = 64; sourceRect.Height = 14; timePerFrame = 250; numberOfFrames = 4; Sprite coin = new CoinSprite(game.scene, Vector2.Zero, texture, sourceRect, timePerFrame, numberOfFrames, true); return coin; } case spriteType.oneUp: { sourceRect.X =16 ; sourceRect.Y = 16; sourceRect.Width = 16; sourceRect.Height = 16; Sprite oneUp = new OneUpSprite(game.scene, Vector2.Zero, texture, sourceRect, timePerFrame, numberOfFrames, false); game.scene.MovSprites.Add(oneUp); return oneUp; } default: { return null; } } }