void KeyClicked(object s, EventArgs _k) { KeyboardKeyClickedEventArgs k = (KeyboardKeyClickedEventArgs)_k; if (k.key == Keys.Down) { hover++; if (hover > 2) { hover = 2; } } else if (k.key == Keys.Up) { hover--; if (hover < 1) { hover = 1; } } else if (k.key == Keys.Enter) { if (hover == 1) { #if WINDOWS game.KeyboardKeyClicked -= KeyClicked; #endif game.RunGameMode(); } else if (hover == 2) { game.Exit(); } } }
void KeyClicked(object s, EventArgs _k) { KeyboardKeyClickedEventArgs k = (KeyboardKeyClickedEventArgs)_k; if (k.key == Keys.Space) { // don't shoot if player is dead if (!RotatingShip.ListOfShips.Contains(playerShip)) { return; } Bullet b = new Bullet(playerShip.Hitbox.Center.X - 2 * RotatingShip.Scale, playerShip.Position.Y, BulletType.ALLY); GameEvent(GameEventEnum.PLAYER_FIRE); } }