Exemple #1
0
        public void MarioBelowGoombaTest()
        {
            //Make Mario, Goomba, and Movement Command
            IMario mario  = new Mario(new Vector2(500, 750));
            IEnemy goomba = new Goomba(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveUp = new UpCommand(level);

            //Move Mario Up until he has jumped past the Goomba
            Rectangle marioPosition = mario.DrawnRectangle;

            while (marioPosition.Y > 490)
            {
                moveUp.Execute();
                level.Update();
                marioPosition = mario.DrawnRectangle;
            }

            //Check test results, Mario should die
            if (!mario.IsDead())
            {
                writer.WriteLine("Mario Below Goomba Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Below Goomba Test: Successful\n");
            }
        }
Exemple #2
0
        public void MarioAboveGoombaTest()
        {
            //Make Mario, Goomba, and Movement Command
            IMario mario  = new Mario(new Vector2(500, 250));
            IEnemy goomba = new Goomba(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveDown = new DownCommand(level);

            //Move Mario Down until he has fallen past the Goomba
            Rectangle marioPosition = mario.DrawnRectangle;

            while (marioPosition.Y < 500 - marioPosition.Height)
            {
                moveDown.Execute();
                level.Update();
                marioPosition = mario.DrawnRectangle;
            }

            //Check test results, Mario should live
            if (mario.IsDead())
            {
                writer.WriteLine("Mario Above Goomba Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Above Goomba Test: Successful\n");
            }
        }
Exemple #3
0
        public GoombaSprite(Goomba goomba)
        {
            this.Goomba       = goomba;
            this.CurrentFrame = SpriteHolder.WalkingGoombaStartFrame;
            this.TotalFrames  = SpriteHolder.WalkingGoombaFrames + SpriteHolder.WalkingGoombaStartFrame;
            this.Texture      = SpriteHolder.WalkingGoomba;

            this.Width  = SpriteHolder.GoombaWidth;
            this.Height = this.Texture.Height;
        }
Exemple #4
0
        private IEnemy CreateSpawnEnemy()
        {
            IEnemy          spawnEnemy    = new Goomba(this.CurrentPosition, true);
            EnemyDescriptor randomPowerup = (EnemyDescriptor)this.RandomNumber.Next(0, EnemySpawnerConfig.NumberOfUniqueEnemies);
            bool            rightFacing   = this.RandomNumber.Next(0, 2) == 1;

            switch (randomPowerup)
            {
            case EnemyDescriptor.Goomba:
                spawnEnemy = new Goomba(this.CurrentPosition, rightFacing);
                break;

            case EnemyDescriptor.Koopa:
                spawnEnemy = new Koopa(this.CurrentPosition, rightFacing);
                break;
            }
            return(spawnEnemy);
        }
Exemple #5
0
        public void SpawnEnemy(Vector2 Position, String s)
        {
            IEnemy e;

            switch (s[1])
            {
            case 'G':
                if (s.Length > 2 && s[2] == 'R')
                {
                    e = new Goomba(Position, true);
                }
                else
                {
                    e = new Goomba(Position, false);
                }
                this.level.Enemies.Add(e);
                break;

            case 'K':
                if (s.Length > 2 && s[2] == 'R')
                {
                    e = new Koopa(Position, true);
                }
                else
                {
                    e = new Koopa(Position, false);
                }
                this.level.Enemies.Add(e);
                break;

            case 'F':
                if (s.Length > 2 && s[2] == 'R')
                {
                    e = new FlyingKoopa(Position, true);
                }
                else
                {
                    e = new FlyingKoopa(Position, false);
                }
                this.level.Enemies.Add(e);
                break;

            case 'S':
                if (s.Length > 2 && s[2] == 'R')
                {
                    e = new Spiny(Position, true);
                }
                else
                {
                    e = new Spiny(Position, false);
                }
                this.level.Enemies.Add(e);
                break;

            case 'L':
                if (s.Length > 2 && s[2] == 'R')
                {
                    e = new Lakitu(Position, this.level);
                }
                else
                {
                    e = new Lakitu(Position, this.level);
                }
                this.level.Enemies.Add(e);
                break;
            }
        }
 public GoombaCollisionResponder(Goomba goomba)
 {
     this.Goomba = goomba;
 }