コード例 #1
0
ファイル: Menu.cs プロジェクト: admm20/GalagaMG
        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();
                }
            }
        }
コード例 #2
0
        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);
            }
        }