Esempio n. 1
0
 public void Update()
 {
     //Console.WriteLine(StaticDisplay.FPSCount);
     if (gameStart && !gameOver)
     {
         IsKeyDown();
         tickCounter++;
         if (tickCounter > 25 && !gameOver)
         {
             tickCounter = 0;
             for (int i = 0; i < player.Length; i++)
             {
                 if (!player[i].MoveSnake(berryList.BerryPos, MergeSnakes(), btmEyes))
                 {
                     gameOver = true;
                     MessageBox.Show(player[i].Name + " lost. Press Space to restart");
                 }
             }
             if (SpawnBerryReady())
             {
                 berryList.SpawnBerry(player, MergeSnakes());
             }
         }
     }
 }
Esempio n. 2
0
 public void Restart()
 {
     CreatePlayer();
     CreateField();
     tickCounter = 0;
     berryList   = new SnakeBerry(fieldCountX, fieldCountY);
     berryList.SpawnBerry(player, MergeSnakes());
     gameOver = false;
 }
Esempio n. 3
0
 public void Update()
 {
     IsKeyDown();
     tickCounter++;
     if (tickCounter > 17 && !gameOver)
     {
         tickCounter = 0;
         for (int i = 0; i < player.Length; i++)
         {
             if (!player[i].MoveSnake(berryList.BerryPos, MergeSnakes()))
             {
                 gameOver = true;
                 MessageBox.Show(player[i].Name + " lost. Press Space to restart");
             }
         }
         if (SpawnBerryReady())
         {
             berryList.SpawnBerry(player, MergeSnakes());
         }
     }
 }