Пример #1
0
        static void Main(string[] args)
        {
            // Create the GameWorld, Player, Invaders and GraphicsManager
            GameWorld        game             = new GameWorld();
            BallisticManager ballisticManager = new BallisticManager();
            Player           player           = new Player(game.Y - 1);
            Invaders         invaders         = new Invaders();
            GraphicsManager  graphicsManager  = new GraphicsManager(game);

            // Register player and Invaders with the GameWorld
            game.RegisterPlayer(player);
            game.RegisterInvaders(invaders);
            game.RegisterBallisticManager(ballisticManager);
            game.Start();

            // Game Loop
            while (true)
            {
                // Update the GameWorld
                game.Update();

                // Update and Draw the game
                graphicsManager.Update();
                graphicsManager.Draw();

                // Don't hammer the CPU
                Thread.Sleep(5);
            }
        }
Пример #2
0
 /// <summary>
 /// Register the Space Invaders with the game world
 /// </summary>
 /// <param name="invaders"></param>
 public void RegisterInvaders(Invaders argInvaders)
 {
     _invaders            = argInvaders;
     _invaders.LeftBound  = 1;
     _invaders.RightBound = X;
 }