示例#1
0
 private void Survival_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.P)
     {
         using (PauseGame pauseGame = new PauseGame())
         {
             pauseGame.ShowDialog();
         }
     }
     if (e.KeyCode == Keys.D)
     {
         if (heroLocation.X < pbSurvival.Size.Height - heroSize * 2)
         {
             heroLocation.X += heroSize;
         }
     }
     if (e.KeyCode == Keys.A)
     {
         if (heroLocation.X > heroSize)
         {
             heroLocation.X -= heroSize;
         }
     }
     if (e.KeyCode == Keys.S)
     {
         if (heroLocation.Y < pbSurvival.Size.Width - heroSize * 2)
         {
             heroLocation.Y += heroSize;
         }
     }
     if (e.KeyCode == Keys.W)
     {
         if (heroLocation.Y > heroSize)
         {
             heroLocation.Y -= heroSize;
         }
     }
     ChangeHeroLocation();
     HeroTurn();
 }
示例#2
0
        private void btnContinue_Click(object sender, EventArgs e)
        {
            PauseGame pGame = new PauseGame();

            pGame.Close();
        }