コード例 #1
0
ファイル: Game.cs プロジェクト: ngaeta/Lunar-Land
        public static void Play()
        {
            isPlaying    = true;
            winnerText   = new SpriteLabel(window.width / 2, window.height / 2, WINNER_FILE);
            gameOverText = new SpriteLabel(window.width / 2, window.height / 2, GAME_OVER_FILE);
            GfxTools.Init(window);
            GroundManager.Init();
            Background background = new Background(250, 5);

            playerShip = new Ship(50, window.height - GroundManager.GetGroundHeight() - 24, frictionX * 1.8f, gravity * 2f);
            AsteroidsManager.Init(12, 0, (int)(GroundManager.GetGroundPosition().Y - playerShip.Height * 2));

            while (isPlaying)
            {
                if (Win.GetKey(KeyCode.Esc) || !Win.opened)
                {
                    return;
                }

                GfxTools.CleanScreen();

                if (canInput)
                {
                    playerShip.Input();
                }

                playerShip.Update();

                background.Draw();
                playerShip.Draw();
                AsteroidsManager.Draw();
                GroundManager.Draw();
                window.Blit();

                CheckGameStats();
            }

            //mettere if player è morto break, e fuori da isplaying usare Wait o altro metodo per disegnare il risultato
        }