} // end method animationTimer_Tick /*If the user types Q at any point, the game quits. * If game is over and the user types S, the game restarts. * If the user types space, a shot fires. * If the user has a bomb and tpes B, a bomb fires. */ private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Q) { Application.Exit(); } if (gameOver) { if (e.KeyCode == Keys.S) { StartNewGame(); return; } // end if } // end if if (e.KeyCode == Keys.Space) { game.FirePlayerShot(); } if (e.KeyCode == Keys.B) { game.FirePlayerBomb(); } if (e.KeyCode == Keys.P) { if (!paused) { gameTimer.Enabled = false; animationTimer.Enabled = false; paused = true; } else { gameTimer.Enabled = true; animationTimer.Enabled = true; paused = false; } } if (keysPressed.Contains(e.KeyCode)) { keysPressed.Remove(e.KeyCode); } keysPressed.Add(e.KeyCode); } // end method Form1_KeyDown