private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Down || e.KeyCode == Keys.Up) { mainPlayer.Image = Properties.Resources.cowboy_run; if (e.KeyCode == Keys.Left) { LeftMoveTimer.Start(); } if (e.KeyCode == Keys.Right) { RightMoveTimer.Start(); } if (e.KeyCode == Keys.Up) { UpMoveTimer.Start(); } if (e.KeyCode == Keys.Down) { DownMoveTimer.Start(); } } if (e.KeyCode == Keys.Space) { ShootingTimer.Start(); } if (e.KeyCode == Keys.Escape) { Process.GetCurrentProcess().Kill(); } }
private void Form1_KeyDown(object sender, KeyEventArgs e) { if (!pause) { if (e.KeyCode == Keys.Right) { RightMoveTimer.Start(); } if (e.KeyCode == Keys.Left) { LeftMoveTimer.Start(); } if (e.KeyCode == Keys.Up) { UpMoveTimer.Start(); } if (e.KeyCode == Keys.Down) { DownMoveTimer.Start(); } if (e.KeyCode == Keys.Space) { if (currentAmmo < limAmmo) { currentAmmo++; fire = true; } } } }
// This is when key is pressed private void Form1_KeyDown(object sender, KeyEventArgs e) { if (!pause) { if (e.KeyCode == Keys.Right) { RightMoveTimer.Start(); } if (e.KeyCode == Keys.Left) { LeftMoveTimer.Start(); } if (e.KeyCode == Keys.Down) { DownMoveTimer.Start(); } if (e.KeyCode == Keys.Up) { UpMoveTimer.Start(); } } }
private void StartTimers() { LeftMoveTimer.Start(); RightMoveTimer.Start(); LaserTimer.Start(); EnemiesTimer.Start(); }
private void StartTimers() { int milliseconds = 2000; Thread.Sleep(milliseconds); LeftMoveTimer.Start(); RightMoveTimer.Start(); UpMoveTimer.Start(); DownMoveTimer.Start(); MoveBgTimer.Start(); MoveEnemiesTimer.Start(); MoveAmmunitionTimer.Start(); EnemiesAmmunitionTimer.Start(); }
private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left) { if (Spaceship.spaceshipX > 20) { LeftMoveTimer.Start(); } else { LeftMoveTimer.Stop(); Spaceship.spaceshipV = 0; } } if (e.KeyCode == Keys.Right) { if (Spaceship.spaceshipX < 580) { RightMoveTimer.Start(); } else { RightMoveTimer.Stop(); Spaceship.spaceshipV = 0; } } if (e.KeyCode == Keys.Space) { LaserTimer.Start(); } if (e.KeyCode == Keys.R) { ResetGame(); } }