Пример #1
0
        private void gameTimer_Tick(object sender, EventArgs e)
        {
            game.go();
            if (this.status == Status.playing)
            {
                foreach (Keys i in keysPressed)
                {
                    switch (GameKeys.interpret(i))
                    {
                    case GameBehaviors.moveUp:
                        game.movePlayer(Direction.up);
                        break;

                    case GameBehaviors.moveDown:
                        game.movePlayer(Direction.down);
                        break;

                    case GameBehaviors.moveLeft:
                        game.movePlayer(Direction.left);
                        break;

                    case GameBehaviors.moveRight:
                        game.movePlayer(Direction.right);
                        break;

                    case GameBehaviors.shot:
                        game.shot();
                        break;



                    default:
                        break;
                    }
                }
            }


            this.playerShip.Location = game.getPlayerPoisition();
            this.currentScore.Text   = game.currentScore.ToString();
            this.playerLife.Text     = "X" + game.getPlayerLife().ToString();

            this.Refresh();
        }