Exemple #1
0
 private void GameOver()
 {
     TimerAnimate.Stop();
     TimerMove.Stop();
     heroImageCount = 0;
     TimerHeroMelt.Start();
 }
Exemple #2
0
 private void Game_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.W)
     {
         verVelocity   = -heroStep;
         horVelocity   = 0;
         heroDirection = "up";
     }
     else if (e.KeyCode == Keys.S)
     {
         verVelocity   = heroStep;
         horVelocity   = 0;
         heroDirection = "down";
     }
     else if (e.KeyCode == Keys.A)
     {
         verVelocity   = 0;
         horVelocity   = -heroStep;
         heroDirection = "left";
     }
     else if (e.KeyCode == Keys.D)
     {
         verVelocity   = 0;
         horVelocity   = heroStep;
         heroDirection = "right";
     }
     else if (e.KeyCode == Keys.P)
     {
         if (!gamePaused)
         {
             TimerAnimate.Stop();
             TimerMove.Stop();
             gamePaused = true;
         }
         else
         {
             TimerAnimate.Start();
             TimerMove.Start();
             gamePaused = false;
         }
     }
     RandomChangeEnemyDirection();
 }
Exemple #3
0
 private void Game_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Up)
     {
         verVelocity   = -heroStep;
         horVelocity   = 0;
         heroDirection = "up";
     }
     else if (e.KeyCode == Keys.Down)
     {
         verVelocity   = heroStep;
         horVelocity   = 0;
         heroDirection = "down";
     }
     else if (e.KeyCode == Keys.Left)
     {
         horVelocity   = -heroStep;
         verVelocity   = 0;
         heroDirection = "left";
     }
     else if (e.KeyCode == Keys.Right)
     {
         horVelocity   = heroStep;
         verVelocity   = 0;
         heroDirection = "right";
     }
     else if (e.KeyCode == Keys.P) // noepiezot P ir pauze
     {
         if (!gamePaused)
         {
             TimerAnimate.Stop();
             TimerMove.Stop();
             gamePaused = true;
         }
         else
         {
             TimerAnimate.Start();
             TimerMove.Start();
             gamePaused = false;
         }
     }
     randomChangeEnemyDirection();
 }