Esempio n. 1
0
 public bool ObjectCollisions(Mario mario, char[,] gameGround, Movement movement, Game game)
 {
     if (movement.RightButton == true)
     {
         if (gameGround[mario.X, mario.Y - 1] == '[')
         {
             movement.CanMove    = false;
             game.GameInProgress = false;
             game.GameFinished   = true;
         }
         if (gameGround[mario.X, mario.Y - 1] == 'X')
         {
             movement.CanMove = false;
         }
         else
         {
             movement.CanMove = true;
         }
     }
     else if (movement.LeftButton == true)
     {
         if (gameGround[mario.X - 2, mario.Y - 1] == 'X')
         {
             movement.CanMove = false;
         }
         else
         {
             movement.CanMove = true;
         }
     }
     else if (movement.UpButton == true)
     {
         if (gameGround[mario.X - 1, mario.Y - 2] == 'X')
         {
             movement.CanMove = false;
         }
         else
         {
             movement.CanMove = true;
         }
     }
     return(movement.CanMove);
 }
Esempio n. 2
0
 public bool CheckLife(Mario mario, List <Monster> listMonsters, Game game)
 {
     foreach (var monster in listMonsters)
     {
         if ((mario.X + 1 == monster.X && mario.Y == monster.Y) ||
             (mario.X == monster.X && mario.Y == monster.Y))
         {
             mario.Life          = false;
             game.GameOver       = true;
             game.GameInProgress = false;
             return(game.GameOver);
         }
         else if (mario.X - 1 == monster.X && mario.Y == monster.Y)
         {
             mario.Life          = false;
             game.GameOver       = true;
             game.GameInProgress = false;
             return(game.GameOver);
         }
     }
     return(mario.Life);
 }
Esempio n. 3
0
 public void MarioShoot(Mario mario, List <Bullet> listBullets)
 {
     listBullets.Add(new Bullet(mario.X + 1, mario.Y));
 }