Ejemplo n.º 1
0
 public void Draw()
 {
     if (IsVisible)
     {
         GfxTools.DrawFullSquare((int)position.X, (int)position.Y, (int)position.X + width, (int)position.Y + width, color.R, color.G, color.B);
     }
 }
Ejemplo n.º 2
0
        static Game()
        {
            window = new Window(1200, 700, "Square's Invaders", PixelFormat.RGB);
            GfxTools.Init(window);

            Gravity = 555;

            Vector2 playerPosition;

            playerPosition.X = window.width / 2;
            playerPosition.Y = window.height - 20;
            EnemyManager.Init(66, 6);
            player = new Player(playerPosition, 100, 60);
        }
Ejemplo n.º 3
0
        public static void Play()
        {
            int timer = 120;

            while (window.opened)
            {
                totalTime += GfxTools.Window.deltaTime;
                GfxTools.ClearScreen();
                //Input
                if (window.GetKey(KeyCode.Esc))
                {
                    return;
                }
                if (!player.IsAlive || EnemyManager.Landed)
                {
                    return;
                }

                player.Input();
                //Update
                EnemyManager.Update();
                if (EnemyManager.GetAlives() <= 0)
                {
                    timer--;
                    if (timer <= 0)
                    {
                        return;
                    }
                }
                player.Update();
                //Draw
                EnemyManager.Draw();
                player.Draw();

                window.Blit();
            }
        }
Ejemplo n.º 4
0
 public void Draw()
 {
     GfxTools.DrawFullSquare((int)(Position.X - width / 2), (int)(Position.Y - height / 2), (int)(Position.X + width / 2), (int)(Position.Y + height / 2), color.R, color.G, color.B);
 }
Ejemplo n.º 5
0
 public void Draw()
 {
     GfxTools.DrawFullSquare((int)position.X, (int)position.Y, (int)(position.X + width), (int)(position.Y + height), rectColor.R, rectColor.G, rectColor.B);
 }