private void pressArrow(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Up: controller.ActionPerformed(TwoZeroFourEightController.UP); break; case Keys.Left: controller.ActionPerformed(TwoZeroFourEightController.LEFT); break; case Keys.Right: controller.ActionPerformed(TwoZeroFourEightController.RIGHT); break; case Keys.Down: controller.ActionPerformed(TwoZeroFourEightController.DOWN); break; } lblDisplay.Text = (model.GetScore()).ToString(); if (model.GameOver()) { lblSta.Text = (model.GameOver() ? "Game Over" : lblSta.Text); GameOverScreen end = new GameOverScreen(lblDisplay.Text); end.Show(); } }
private void btnRight_KeyPress(object sender, KeyPressEventArgs e) { switch (e.KeyChar) { case (char)Keys.Left: controller.ActionPerformed(TwoZeroFourEightController.LEFT); break; case (char)Keys.Right: controller.ActionPerformed(TwoZeroFourEightController.RIGHT); break; case (char)Keys.Up: controller.ActionPerformed(TwoZeroFourEightController.UP); break; case (char)Keys.Down: controller.ActionPerformed(TwoZeroFourEightController.DOWN); break; } if (model.GameOver()) { popGameOver(); } }