Exemple #1
0
        public void MarioFlowerTest()
        {
            //Make Mario, Flower, and Movement Command
            IMario mario  = new Mario(new Vector2(250, 500));
            IItem  flower = new FireFlower(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveRight = new RightCommand(level);

            //Move Mario Right until he has collided with the Flower
            Rectangle marioPosition = mario.DrawnRectangle;

            while (marioPosition.X < 510)
            {
                moveRight.Execute();
                level.Update();
                marioPosition = mario.DrawnRectangle;
            }

            //Check test results, Mario should be Fire type
            if (!mario.IsFire())
            {
                writer.WriteLine("Mario Flower Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Flower Test: Successful\n");
            }
        }
Exemple #2
0
        private IItem CreateSpawnItem()
        {
            IItem             spawnItem     = new Mushroom(this.CurrentPosition, true, MushroomType.Green);
            PowerupDescriptor randomPowerup = (PowerupDescriptor)this.RandomNumber.Next(0, Enum.GetNames(typeof(PowerupDescriptor)).Length);

            switch (randomPowerup)
            {
            case PowerupDescriptor.Star:
                spawnItem = new Star(this.CurrentPosition, true);
                break;

            case PowerupDescriptor.GreenMushroom:
                spawnItem = new Mushroom(this.CurrentPosition, true, MushroomType.Green);
                break;

            case PowerupDescriptor.MetalMushroom:
                spawnItem = new Mushroom(this.CurrentPosition, true, MushroomType.Metal);
                break;

            case PowerupDescriptor.RedMushroom:
                if (this.Level.Mario.IsBig())
                {
                    spawnItem = new Mushroom(this.CurrentPosition, true, MushroomType.Red);
                }
                else
                {
                    spawnItem = new FireFlower(this.CurrentPosition, true);
                }
                break;
            }
            return(spawnItem);
        }
        public FireFlowerSprite(FireFlower fireFlower)
        {
            this.FireFlower   = fireFlower;
            this.Texture      = SpriteHolder.PowerUps;
            this.CurrentFrame = (int)SpriteHolder.FireFlowerStartCoordinates[0];

            this.Width  = SpriteHolder.PowerUpWidth;
            this.Height = SpriteHolder.PowerUpHeight;
        }
Exemple #4
0
        public void SpawnItem(Vector2 Position, String s)
        {
            IItem i;

            switch (s[1])
            {
            case 'C':
                i = new Coin(Position, false);
                this.level.Items.Add(i);
                break;

            case 'S':
                i = new Star(Position, true);
                this.level.Items.Add(i);
                break;

            case 'R':
                i = new Mushroom(Position, true, MushroomType.Red);
                this.level.Items.Add(i);
                break;

            case 'M':
                i = new Mushroom(Position, true, MushroomType.Metal);
                this.level.Items.Add(i);
                break;

            case '1':
                i = new Mushroom(Position, true, MushroomType.Green);
                this.level.Items.Add(i);
                break;

            case 'F':
                i = new FireFlower(Position, true);
                this.level.Items.Add(i);
                break;
            }
        }
 public FireFlowerCollisionResponder(FireFlower fireFlower)
 {
     this.FireFlower = fireFlower;
 }