private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { RightTimer.Stop(); LeftTimer.Stop(); JumpTimer.Stop(); PhysicTimer.Stop(); }
private void Form1_KeyUp(object sender, KeyEventArgs e) { LeftTimer.Stop(); RightTimer.Stop(); UpTimer.Stop(); DownTimer.Stop(); }
/// <summary> /// stop timers method, timers are responsible for rendering graphic /// </summary> private void StopTimers() { MoveBackground.Stop(); RightTimer.Stop(); LeftTimer.Stop(); MoveEnemiesTimer.Stop(); MunitionTimer.Stop(); EnemiesMunitionTimer.Stop(); }
/// <summary> ///Method responsible for stop moving /// </summary> /// <param name="sender">The even sender</param> /// <param name="e">The event object</param> private void Form1_KeyUp(object sender, KeyEventArgs e) { RightTimer.Stop(); LeftTimer.Stop(); //pause the game if (e.KeyCode == Keys.Space) { if (!gameIsOver) { if (pause) { StartTimers(); label1.Visible = false; pause = false; } else { label1.Location = new Point(this.Width / 2 - 120, 150); label1.Text = "PAUSED"; label1.Visible = true; StopTimers(); pause = true; } } } //end fire if (e.KeyCode == Keys.S) { MunitionTimer.Stop(); for (int i = 0; i < munitions.Length; i++) { munitions[i].Visible = false; } } }