示例#1
0
        static Game()
        {
            Color playerColor = new Color(0, 0, 255);
            Color alienColor  = new Color(0, 255, 0);

            window = new Window(1000, 700, "Square Invaders", PixelFormat.RGB);
            GfxTools.Init(window);
            EnemyManager.Init(18, 3);
            BarrierManager.Init(new Vector2(65, 500));
            player    = new Player(500, 630);
            points    = new SpriteText(new Vector2(10, 10), "000000");
            totalTime = 0;
            score     = 0;
        }
示例#2
0
        public static void Play()
        {
            while (window.opened)
            {
                if (window.GetKey(KeyCode.Esc))
                {
                    return;
                }

                GfxTools.ClearScreen();

                player.KeyInput();

                EnemyManager.Update();
                player.Update();
                points.SetText(GetScore().ToString("D6"));

                if (EnemyManager.GetAlives() <= 0 || !player.isAlive)
                {
                    break;
                }

                player.Draw();
                EnemyManager.Draw();
                points.Draw();
                BarrierManager.Draw();

                window.Blit();
            }

            while (window.opened)
            {
                GfxTools.ClearScreen();

                player.Draw();
                EnemyManager.Draw();
                points.SetText(GetScore().ToString("D6"));
                points.Draw();
                BarrierManager.Draw();

                window.Blit();
            }
        }
示例#3
0
 public void Draw()
 {
     GfxTools.DrawSprite(sprite, (int)position.X, (int)position.Y);
 }
示例#4
0
 public void Draw()
 {
     GfxTools.FullRectangle((int)Position.X - width / 2, (int)Position.Y - height / 2, height, width, color.R, color.G, color.B);
 }
示例#5
0
 public void Draw()
 {
     GfxTools.DrawSprite(bullets[animation.CurrentFrame], (int)Position.X, (int)Position.Y);
 }
示例#6
0
 public void Draw()
 {
     GfxTools.FullRectangle((int)Position.X, (int)Position.Y, size, size, color.R, color.G, color.B);
 }
示例#7
0
 public void Draw()
 {
     GfxTools.FullRectangle((int)position.X, (int)position.Y, width, height, color.R, color.G, color.B);
 }