Example #1
0
        public void Draw()
        {
            for (int i = 0; i < stairs.Length; i++)
            {
                GfxTools.DrawSolidRect(stairs[i], color, color);
            }

            if (planets != null)
            {
                for (int i = 0; i < planets.Length; i++)
                {
                    planets[i].Draw();
                }
            }
        }
Example #2
0
        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
        }
Example #3
0
 public void Draw()
 {
     GfxTools.DrawSprite(sprite, (int)position.X, (int)position.Y);
 }
Example #4
0
 public void Draw()
 {
     GfxTools.DrawSprite(sprite.GetSprite(), (int)(Position.X - Width / 2), (int)(Position.Y - Height / 2));
 }