Beispiel #1
0
 public virtual void VisitWallRoot(WallRoot w)
 {
     //shouldn't call this
     //need to implement in concrete class
     Debug.WriteLine("Visit by WallGroup not implemented");
     Debug.Assert(false);
 }
Beispiel #2
0
        public override void VisitWallRoot(WallRoot w)
        {
            // AlienGrid vs WallRoot
            //     Debug.WriteLine("collide: {0} with {1}", this, w);

            // WallRight vs Grid
            ColPair.Collide(this, (GameObject)w.pChild);
        }
Beispiel #3
0
        public Wall createWall(Wall.WallType mWallType, GameObject.GameObjectName gameName, int index = 0, float x = 0.0f, float y = 0.0f, float width = 0.0f, float height = 0.0f)
        {
            Wall wall = null;

            switch (mWallType)
            {
            case Wall.WallType.WallTop:
                wall = new WallTop(gameName, index, Sprite.SpriteName.NullObject, x, y, width, height, Wall.WallType.WallTop);
                break;

            case Wall.WallType.WallDown:
                wall = new WallDown(gameName, index, Sprite.SpriteName.NullObject, x, y, width, height, Wall.WallType.WallDown);
                break;

            case Wall.WallType.WallLeft:
                wall = new WallLeft(gameName, index, Sprite.SpriteName.NullObject, x, y, width, height, Wall.WallType.WallLeft);
                break;

            case Wall.WallType.WallRight:
                wall = new WallRight(gameName, index, Sprite.SpriteName.NullObject, x, y, width, height, Wall.WallType.WallRight);
                break;

            case Wall.WallType.WallRoot:
                wall = new WallRoot(gameName, index, Sprite.SpriteName.NullObject, Wall.WallType.WallRoot);
                GameObjectNodeManager.add(wall, cPCSTree);
                break;

            case Wall.WallType.Uninitilized:
                Debug.WriteLine("Wall Type is Uninitilized");
                break;
            }

            this.cPCSTree.Insert(wall, this.cParent);

            wall.addSpriteToBatch(this.cSpriteBatch);
            wall.addCollisionToBatch(SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes));
            return(wall);
        }
 //wall
 public override void VisitWallRoot(WallRoot w)
 {
     //  Debug.WriteLine("UFORoot WallRoot");
     CollisionPair.detectCollision((GameObject)w.pChild, this);
 }
Beispiel #5
0
        //-----------------------------------------------------------------------------------------
        //visit wall tree
        //-------------------------------------
        //root, wallRight, wallLeft, wallTop, wallBottom

        //-------------------------------------
        public virtual void VisitWallRoot(WallRoot w)
        {
            Debug.WriteLine("Visit by WallRoot not implemented");
            Debug.Assert(false);
        }
 //Walls
 public override void VisitWallRoot(WallRoot w)
 {
     //   Debug.WriteLine("FlippingBomb WallRoot");
     CollisionPair.detectCollision(this, (GameObject)w.pChild);
 }
 public override void VisitWallRoot(WallRoot w)
 {
     Debug.WriteLine("CannonShip WallRoot");
     CollisionPair.detectCollision(this, (GameObject)w.pChild);
 }
Beispiel #8
0
        //-----------------------------------------------------------------------------
        // Game::LoadContent()
        //		Allows you to load all content needed for your engine,
        //	    such as objects, graphics, etc.
        //-----------------------------------------------------------------------------

        public override void LoadContent()
        {
            Debug.WriteLine("----------------------------------");
            Debug.WriteLine("Load Content");
            Debug.WriteLine("----------------------------------\n");


            //-----------------------------------------------
            //Create Game Simulation instance
            Simulation.Create();

            //-----------------------------------------------
            //Manager Load
            //------------------------------
            //Texture Manager Create
            TextureManager.Create();
            //------------------------------
            //Image Manager Create
            ImageManager.Create();
            //------------------------------
            //Game/Box Sprite Manager Create
            GameSpriteManager.Create(5, 2);
            BoxSpriteManager.Create();
            //------------------------------
            //SpriteBatch Manager Create
            SpriteBatchManager.Create();
            //------------------------------
            //ProxySprite Manager Create
            ProxySpriteManager.Create(10, 1);
            //------------------------------
            //GameObject Manager Create
            GameObjectManager.Create();
            //------------------------------
            //CollisionPair Manager Create
            ColPairManager.Create();
            //------------------------------
            //TimerEvent Manager Create
            TimerEventManager.Create();
            //------------------------------
            //Glyph/Font Manager Create/Load
            GlyphManager.Create();
            FontManager.Create();

            //------------------------------
            //Death/Ghost Manager Create
            DeathManager.Create(1, 1);
            GhostManager.Create(1, 1);
            //-----------------------------------------------
            // Input Manager - Key Observer Load
            InputManager.LoadKeyInputObservers();

            //-----------------------------------------------
            //Print some initial stats
            TextureManager.DumpStats();
            ImageManager.DumpStats();
            GameSpriteManager.DumpStats();
            BoxSpriteManager.DumpStats();
            SpriteBatchManager.DumpStats();
            ProxySpriteManager.DumpStats();
            TimerEventManager.DumpStats();
            GameObjectManager.DumpStats();
            DeathManager.DumpStats();
            GhostManager.DumpStats();
            ColPairManager.DumpStats();
            GlyphManager.DumpStats();

            //------------------------------
            //Asset Loading

            //Texture/Image/Font Load
            TextureManager.LoadTextures();
            ImageManager.LoadImages();
            FontManager.LoadFonts();

            //-----------------------------------------------
            //Sprite Batch /Sprite Load
            SpriteBatch pSB_GameSprites = SpriteBatchManager.Add(SpriteBatch.Name.GameSprites);
            SpriteBatch pShields        = SpriteBatchManager.Add(SpriteBatch.Name.Shields);
            SpriteBatch pSB_Boxes       = SpriteBatchManager.Add(SpriteBatch.Name.SpriteBoxes);
            SpriteBatch pSB_Texts       = SpriteBatchManager.Add(SpriteBatch.Name.TextLetters);


            //-----------------------------------------------
            //Sprites/BoxSprites Load
            //NOTE that the following coordinates will not matter
            //once proxy sprites are used!

            //35w x 35h for all sprites;
            float const_AlienSpriteSize = 30.0f;


            //render dimensions/coordinates
            float squid_sX = 400.0f;
            float squid_sY = 400.0f;

            float crab_sX = 400.0f;
            float crab_sY = 350.0f;

            float octo_sX = 400.0f;
            float octo_sY = 300.0f;

            float missileSpriteWidth  = 4.0f;
            float missileSpriteHeight = 8.0f;

            float alienBombSpriteWidth  = 6.0f;
            float alienBombSpriteHeight = 12.0f;

            float shipSpriteWidth  = 55.0f;
            float shipSpriteHeight = 25.0f;

            float verticalWallWidth  = 678.0f;
            float verticalWallHeight = 10.0f;

            float horizontalWallWidth  = 678.0f;
            float horizontalWallHeight = 10.0f;

            //----------------------
            //aliens (initial sprites only)

            //note that the alien grid and alien column are game sprites for box sprite rendering,
            //but will pass a null image since they don't have anything to render
            GameSpriteManager.Add(GameSprite.Name.AlienGrid, Image.Name.NullObject, 0, 0, 0, 0);
            GameSpriteManager.Add(GameSprite.Name.AlienColumn, Image.Name.NullObject, 0, 0, 0, 0);

            //squid game sprite
            GameSpriteManager.Add(GameSprite.Name.Squid, Image.Name.SquidOpen, squid_sX, squid_sY, const_AlienSpriteSize, const_AlienSpriteSize);
            //crab game sprite
            GameSpriteManager.Add(GameSprite.Name.Crab, Image.Name.CrabOpen, crab_sX, crab_sY, const_AlienSpriteSize, const_AlienSpriteSize);
            //octopus game sprite
            GameSpriteManager.Add(GameSprite.Name.Octopus, Image.Name.OctopusOpen, octo_sX, octo_sY, const_AlienSpriteSize, const_AlienSpriteSize);

            //alien explosion (for explosion animation after alien is destroyed)
            GameSpriteManager.Add(GameSprite.Name.AlienExplosion, Image.Name.AlienExplosionPop, 0, 0, const_AlienSpriteSize, const_AlienSpriteSize);



            //----------------------
            //alien bombs (initial sprites only)

            //zigzag bomb
            GameSpriteManager.Add(GameSprite.Name.ZigZagAlienBomb, Image.Name.AlienBombZigZag_One, 0, 0, alienBombSpriteWidth, alienBombSpriteHeight);
            //cross bomb
            GameSpriteManager.Add(GameSprite.Name.CrossAlienBomb, Image.Name.AlienBombCross_One, 0, 0, alienBombSpriteWidth, alienBombSpriteHeight);
            //rolling bomb
            GameSpriteManager.Add(GameSprite.Name.RollingAlienBomb, Image.Name.AlienBombRolling_Two, 0, 0, alienBombSpriteWidth, alienBombSpriteHeight);

            //----------------------
            //hero ship
            GameSpriteManager.Add(GameSprite.Name.Ship, Image.Name.Ship, 640.0f, 440.0f, shipSpriteWidth, shipSpriteHeight);
            //hero missile
            GameSpriteManager.Add(GameSprite.Name.Missile, Image.Name.Missile, 0, 0, missileSpriteWidth, missileSpriteHeight);

            //----------------------
            //walls (2: top/bottom, left/right)
            //note screen w = 672px wide by 768px
            GameSpriteManager.Add(GameSprite.Name.VerticalWall, Image.Name.NullObject, 0, 0, verticalWallWidth, verticalWallHeight);
            GameSpriteManager.Add(GameSprite.Name.HorizontalWall, Image.Name.NullObject, 0, 0, horizontalWallWidth, horizontalWallHeight);


            //----------------------
            //shield bricks (6)

            float brickSpriteWidth  = 15.0f;
            float brickSpriteHeight = 10.0f;

            GameSpriteManager.Add(GameSprite.Name.ShieldBrick, Image.Name.ShieldBrick, 0.0f, 0.0f, brickSpriteWidth, brickSpriteHeight);
            GameSpriteManager.Add(GameSprite.Name.ShieldBrickLeft_Top, Image.Name.ShieldBrickLeft_Top, 0.0f, 0.0f, brickSpriteWidth, brickSpriteHeight);
            GameSpriteManager.Add(GameSprite.Name.ShieldBrickRight_Top, Image.Name.ShieldBrickRight_Top, 0, 0, brickSpriteWidth, brickSpriteHeight);
            GameSpriteManager.Add(GameSprite.Name.ShieldBrickMidLeft_Bottom, Image.Name.ShieldBrickMidLeft_Bottom, 0, 0, brickSpriteWidth, brickSpriteHeight);
            GameSpriteManager.Add(GameSprite.Name.ShieldBrickMid_Bottom, Image.Name.ShieldBrickMid_Bottom, 0, 0, brickSpriteWidth, brickSpriteHeight);
            GameSpriteManager.Add(GameSprite.Name.ShieldBrickMidRight_Bottom, Image.Name.ShieldBrickMidRight_Bottom, 0, 0, brickSpriteWidth, brickSpriteHeight);


            //----------------------
            //alien UFO ship
            float ufoSpriteWidth  = 30.0f;
            float ufoSpriteHeight = 10.0f;

            GameSpriteManager.Add(GameSprite.Name.AlienUFO, Image.Name.AlienUFO, 0, 0, ufoSpriteWidth, ufoSpriteHeight);

            //----------------------
            //BoxSprites are added in the CollisionObject constructor depending on the sprite!



            //-----------------------------------------------
            //Load the Animations (TimerEvents)

            TimerEventManager.LoadAlienAnimations();
            TimerEventManager.LoadBombAnimations();



            //-----------------------------------------------
            //Set the Game Simulation State;

            Simulation.SetState(Simulation.State.Realtime);



            //-----------------------------------------------
            //GameObject Load (Factory)

            //get the PCSRootTree that was created by GameObjectManager
            PCSTree rootGamObjTree = GameObjectManager.GetRootTree();

            //make sure root tree and root have been created;
            Debug.Assert(rootGamObjTree != null);
            Debug.Assert(rootGamObjTree.GetRoot() != null);

            //check the tree
            rootGamObjTree.DumpTree();

            //------------------------------------------------
            // Create Missile Tree

            MissileRoot pMissileRoot = new MissileRoot(GameObject.Name.MissileRoot, GameSprite.Name.NullObject, 0, 0.0f, 0.0f);

            rootGamObjTree.Insert(pMissileRoot, null);
            //pMissileRoot.ActivateCollisionSprite(pSB_Boxes);

            //GameObjectManager.AttachTree(pMissileRoot, rootGamObjTree);
            GameObjectManager.AttachTree(pMissileRoot);

            //TEST------------------
            //PCSTree missileTree = new PCSTree();

            //MissileRoot pMissileRoot = new MissileRoot(GameObject.Name.MissileRoot, GameSprite.Name.NullObject, 0, 0.0f, 0.0f);

            //missileTree.Insert(pMissileRoot, null);
            //pMissileRoot.ActivateCollisionSprite(pSB_Boxes);

            //GameObjectManager.AttachTree(pMissileRoot, rootGamObjTree);
            //rootGamObjTree.Insert(pMissileRoot, rootGamObjTree.GetRoot());

            //------------------------------------------------
            // Create Ship Tree

            ShipRoot shipRoot = new ShipRoot(GameObject.Name.ShipRoot, GameSprite.Name.NullObject, 0, 0.0f, 0.0f);

            DeathManager.Attach(shipRoot);


            //check the tree
            rootGamObjTree.DumpTree();

            //attach the shipRoot to the rootGameObjTree, with the gamObjRoot as parent
            rootGamObjTree.Insert(shipRoot, null);

            //check the tree
            rootGamObjTree.DumpTree();

            //attach the shipRoot to the root game object tree
            //GameObjectManager.AttachTree(shipRoot, rootGamObjTree);
            GameObjectManager.AttachTree(shipRoot);

            //create the ship manager that handles all the ship's states
            ShipManager.CreateShipManager();

            //check the tree
            rootGamObjTree.DumpTree();



            //------------------------------------------------
            // Create an Alien Tree

            //AlienRoot alienRoot = new AlienRoot(GameObject.Name.AlienRoot, GameSprite.SpriteName.Null_Object, 0, 0.0f, 0.0f);

            //create the PCS tree that will hold all alien game objects
            PCSTree pAlienTree = new PCSTree();

            DeathManager.Attach(pAlienTree);

            //create the alien game object factory with pAlienTree as the factory's tree
            //factory will attach all alien game objects to pAlienTree
            AlienFactory pAlienFactory = new AlienFactory(SpriteBatch.Name.GameSprites, pAlienTree);

            DeathManager.Attach(pAlienFactory);

            //attach grid as a child of game object root; grid will be parent of all alien game objects
            Grid pGrid = (Grid)pAlienFactory.Create(AlienType.Type.AlienGrid, GameObject.Name.Grid);

            // set the grid as the root parent to attach all aliens to;
            pAlienFactory.SetParent(pGrid);

            //Build the grid (builder pattern)
            int numberOfColumns = 11;

            //numberOfColumns = 1;
            AlienFactory.BuildAlienGrid(pAlienFactory, pGrid, numberOfColumns);

            //check the tree
            rootGamObjTree.DumpTree();

            //GameObjectManager.AttachTree(pGrid, rootGamObjTree);
            GameObjectManager.AttachTree(pGrid);

            //------------------------------------------------
            // Create Alien Bomb tree

            //create the root
            BombRoot pBombRoot = new BombRoot(GameObject.Name.BombRoot, GameSprite.Name.NullObject, 0, 0.0f, 0.0f);

            //insert root into the bomb tree
            rootGamObjTree.Insert(pBombRoot, null);
            //pBombRoot.ActivateCollisionSprite(pSB_Boxes);

            //add the bombtree to the root tree
            //GameObjectManager.AttachTree(pBombRoot, rootGamObjTree);
            GameObjectManager.AttachTree(pBombRoot);

            //check the tree
            rootGamObjTree.DumpTree();



            //------------------------------------------------
            // Associate and Create Walls
            //note screen = 672px wide by 768px

            WallRoot pWallRoot = new WallRoot(GameObject.Name.WallRoot, GameSprite.Name.NullObject, 0, 0.0f, 0.0f);

            rootGamObjTree.Insert(pWallRoot, null);

            WallTop pWallTop = new WallTop(GameObject.Name.WallTop, GameSprite.Name.HorizontalWall, 0, 336.0f, 728.0f, 612.0f, 10.0f);

            rootGamObjTree.Insert(pWallTop, pWallRoot);
            pWallTop.ActivateCollisionSprite(pSB_Boxes);

            WallBottom pWallBottom = new WallBottom(GameObject.Name.WallBottom, GameSprite.Name.HorizontalWall, 0, 336.0f, 40.0f, 612.0f, 10.0f);

            rootGamObjTree.Insert(pWallBottom, pWallRoot);
            pWallBottom.ActivateCollisionSprite(pSB_Boxes);

            WallRight pWallRight = new WallRight(GameObject.Name.WallRight, GameSprite.Name.HorizontalWall, 0, 652.0f, 384.0f, 10.0f, 693.0f);

            rootGamObjTree.Insert(pWallRight, pWallRoot);
            pWallRight.ActivateCollisionSprite(pSB_Boxes);

            WallLeft pWallLeft = new WallLeft(GameObject.Name.WallLeft, GameSprite.Name.HorizontalWall, 0, 20.0f, 384.0f, 10.0f, 693.0f);

            rootGamObjTree.Insert(pWallLeft, pWallRoot);
            pWallLeft.ActivateCollisionSprite(pSB_Boxes);

            //now that it's fully created, attach the newly created wall tree to the main game object tree
            //GameObjectManager.AttachTree(pWallRoot, rootGamObjTree);
            GameObjectManager.AttachTree(pWallRoot);

            //---------------------------------------------------------------------------------------------------------
            // Shield
            //---------------------------------------------------------------------------------------------------------

            //create the root
            ShieldRoot pShieldRoot = new ShieldRoot(GameObject.Name.ShieldRoot, GameSprite.Name.NullObject, 0, 0.0f, 0.0f);

            rootGamObjTree.Insert(pShieldRoot, null);

            //attach to game object tree
            GameObjectManager.AttachTree(pShieldRoot);

            // create the factory
            ShieldFactory shieldFactory = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Shields, rootGamObjTree);

            // set the parent for hierarchy inside the factory, grid is root, so parent is null
            //shieldFactory.setParent(pShieldRoot);

            // create and attach grid to Root
            //ShieldGrid pShieldGrid = (ShieldGrid)shieldFactory.Create(ShieldCategory.Type.ShieldGrid, GameObject.Name.ShieldGrid);


            float startPos_X = 50.0f;
            float startPos_y = 100.0f;

            //shield 1 - far left
            shieldFactory.BuildShield(pShieldRoot, startPos_X, startPos_y, brickSpriteWidth, brickSpriteHeight);

            //move to the right
            startPos_X = 210.0f;
            shieldFactory.BuildShield(pShieldRoot, startPos_X, startPos_y, brickSpriteWidth, brickSpriteHeight);

            //move to the right
            startPos_X = 370.0f;
            shieldFactory.BuildShield(pShieldRoot, startPos_X, startPos_y, brickSpriteWidth, brickSpriteHeight);


            //move to the right
            startPos_X = 520.0f;
            shieldFactory.BuildShield(pShieldRoot, startPos_X, startPos_y, brickSpriteWidth, brickSpriteHeight);


            //check the tree
            rootGamObjTree.DumpTree();



            //------------------------------------------------
            // Associate and Create Collision Pairs
            ColPair pColPair = null;

            // IMPORTANT: At LEAST two steps when establishing the collision pairs
            // 1) associate object roots in a collision pair,
            // 2) then attach all relevent Observer objects that will execute their specified response to collision
            //todo create an observerObject manager that pools all of these observer objects!

            //---------------------------------------------------------------------------------------------
            //Missile CollisionPairs

            //Missile vs Wall (Top) Collision

            // associate object roots in a collision pair
            pColPair = ColPairManager.Add(ColPair.Name.Missile_Wall, pMissileRoot, pWallRoot);
            //attach all observers that will react to collision
            pColPair.Attach(new ShipReadyObserver());
            pColPair.Attach(new ShipRemoveMissileObserver());

            //--------------------
            // Missile vs Shield collision

            // associate object roots in a collision pair
            pColPair = ColPairManager.Add(ColPair.Name.Misslie_Shield, pMissileRoot, pShieldRoot);
            //attach all observers that will react to this collision
            pColPair.Attach(new RemoveMissileObserver());
            //pColPair.Attach(new DegradeBrickSpriteObserver());
            pColPair.Attach(new RemoveBrickObserver());
            pColPair.Attach(new ShipReadyObserver());


            //--------------------
            //Missile vs AlienGrid collision

            // associate object roots in a collision pair
            pColPair = ColPairManager.Add(ColPair.Name.Alien_Missile, pMissileRoot, pGrid);
            //attach all observers that will react to collision
            pColPair.Attach(new RemoveMissileObserver());
            //todo alien explosion animation isn't working
            pColPair.Attach(new AnimateAlienExplosionObserver());
            pColPair.Attach(new RemoveAlienObserver());
            //pColPair.Attach(new AlienDeathSoundObserver());
            //pColPair.Attach(new AlienScoreUpdateObserver());
            pColPair.Attach(new ShipReadyObserver());

            //---------------------------------------------------------------------------------------------
            //Bomb CollisionPairs


            //Bomb vs Wall (Bottom) Collision

            // associate object roots in a collision pair
            pColPair = ColPairManager.Add(ColPair.Name.Bomb_Wall, pBombRoot, pWallRoot);
            //attach all observers that will react to collision
            //pColPair.Attach(new BombObserver());
            pColPair.Attach(new RemoveBombObserver());


            //todo broken collision - fix
            //--------------------
            //Bomb vs Shield Collision

            // associate object roots in a collision pair
            pColPair = ColPairManager.Add(ColPair.Name.Bomb_Shield, pBombRoot, pShieldRoot);
            //attach all observers that will react to collision
            pColPair.Attach(new RemoveBombObserver());
            pColPair.Attach(new RemoveBrickObserver());

            //todo need to implement collision reaction for bomb v ship
            ////--------------------
            ////Bomb vs Ship Collision

            //// associate object roots in a collision pair
            //pColPair = ColPairManager.Add(ColPair.Name.Bomb_Ship, pBombRoot, shipRoot);
            ////attach all observers that will react to collision
            //pColPair.Attach(new RemoveBombObserver());
            ////pColPair.Attach(new ShipExplosionSoundObserver());
            ////pColPair.Attach(new TriggerGameOverStateObserver());


            //todo need to implement collision reaction for grid v wall, grid vs shield;
            //---------------------------------------------------------------------------------------------
            //AlienGrid/Column CollisionPairs

            ////AlienGrid vs Walls

            //// associate object roots in a collision pair
            //pColPair = ColPairManager.Add(ColPair.Name.Alien_Wall, pGrid, pWallRoot);
            ////attach all observers that will react to collision
            //pColPair.Attach(new AlienGridPivotObserver());

            //--------------------
            //AlienColumn vs Shield Collision

            //// associate object roots in a collision pair
            //pColPair = ColPairManager.Add(ColPair.Name.Alien_Shield, pGrid, pShieldRoot);
            ////attach all observers that will react to collision
            //pColPair.Attach(new RemoveShieldBrickObserver());


            //---------------------------------------------------------------------------------------------
            //Ship CollisionPairs



            Debug.WriteLine("\n\n\n\n\n");
            GameObjectManager.DumpAll();



            Debug.WriteLine("\n\nLoad Content Complete\n----------------------------------\n");

            //-----------------------------------------------
            //Data Dump;

            TextureManager.DumpStats();
            ImageManager.DumpStats();
            GameSpriteManager.DumpStats();
            BoxSpriteManager.DumpStats();
            SpriteBatchManager.DumpStats();
            ProxySpriteManager.DumpStats();
            TimerEventManager.DumpStats();
            GameObjectManager.DumpStats();
            DeathManager.DumpStats();
            GhostManager.DumpStats();
            ColPairManager.DumpStats();
            GlyphManager.DumpStats();

            //TextureManager.DumpLists();
            //ImageManager.DumpLists();
            //GameSpriteManager.DumpLists();
            BoxSpriteManager.DumpLists();
            //SpriteBatchManager.DumpLists();
            //ProxySpriteManager.DumpLists();
            //TimerEventManager.DumpLists();
            //GameObjectManager.DumpLists();
            //DeathManager.DumpLists();
            //GhostManager.DumpLists();
            //ColPairManager.DumpLists();
            //GlyphManager.DumpLists();

            //TextureManager.DumpAll();
            //ImageManager.DumpAll();
            //GameSpriteManager.DumpAll();
            //BoxSpriteManager.DumpAll();
            //SpriteBatchManager.DumpAll();
            //ProxySpriteManager.DumpAll();
            //TimerEventManager.DumpAll();
            //GameObjectManager.DumpAll();
            //DeathManager.DumpAll();
            //GhostManager.DumpAll();
            //ColPairManager.DumpAll();
            //GlyphManager.DumpAll();
        }
Beispiel #9
0
        public Game(bool isFirstRound, bool areCollisionBoxesActive)
        {   // Active Game
            this.SetState(GameStateEnum.Active);
            SpriteBatch sbBoxes      = SpriteBatchManager.Find(SpriteBatchName.Boxes);
            SpriteBatch sbAliens     = SpriteBatchManager.Find(SpriteBatchName.Aliens);
            PCSTree     pRootTree    = GameObjectManager.GetRootTree();
            WallRoot    pWallRoot    = (WallRoot)GameObjectManager.Find(GameObjectName.WallRoot);
            BombRoot    pBombRoot    = (BombRoot)GameObjectManager.Find(GameObjectName.BombRoot);
            MissileRoot pMissileRoot = (MissileRoot)GameObjectManager.Find(GameObjectName.MissileRoot);
            ShipRoot    pShipRoot    = (ShipRoot)GameObjectManager.Find(GameObjectName.ShipRoot);
            UFORoot     pUFORoot     = (UFORoot)GameObjectManager.Find(GameObjectName.UFORoot);
            ShieldRoot  pShieldRoot1 = (ShieldRoot)GameObjectManager.Find(GameObjectName.ShieldRoot, 1);
            ShieldRoot  pShieldRoot2 = (ShieldRoot)GameObjectManager.Find(GameObjectName.ShieldRoot, 2);
            ShieldRoot  pShieldRoot3 = (ShieldRoot)GameObjectManager.Find(GameObjectName.ShieldRoot, 3);
            ShieldRoot  pShieldRoot4 = (ShieldRoot)GameObjectManager.Find(GameObjectName.ShieldRoot, 4);

            if (isFirstRound)
            {
                // Create Walls
                pWallRoot = new WallRoot(GameObjectName.WallRoot, SpriteBaseName.Null, 0.0f, 0.0f, 0);
                pRootTree.Insert(pWallRoot, null);
                if (areCollisionBoxesActive)
                {
                    pWallRoot.ActivateCollisionSprite(sbBoxes);
                }
                WallTop pWallTop = new WallTop(GameObjectName.WallTop, SpriteBaseName.Null, 448.0f, 950.0f, 850.0f, 30.0f, 0);
                pRootTree.Insert(pWallTop, pWallRoot);
                if (areCollisionBoxesActive)
                {
                    pWallTop.ActivateCollisionSprite(sbBoxes);
                }
                pWallTop.ActivateGameSprite(sbAliens);

                WallRight pWallRight = new WallRight(GameObjectName.WallRight, SpriteBaseName.Null, 896.0f, 500.0f, 50.0f, 900.0f, 0);
                pRootTree.Insert(pWallRight, pWallRoot);
                if (areCollisionBoxesActive)
                {
                    pWallRight.ActivateCollisionSprite(sbBoxes);
                }
                pWallRight.ActivateGameSprite(sbAliens);

                WallLeft pWallLeft = new WallLeft(GameObjectName.WallLeft, SpriteBaseName.Null, 0.0f, 500.0f, 50.0f, 900.0f, 0);
                pRootTree.Insert(pWallLeft, pWallRoot);
                if (areCollisionBoxesActive)
                {
                    pWallLeft.ActivateCollisionSprite(sbBoxes);
                }
                pWallLeft.ActivateGameSprite(sbAliens);

                WallBottom pWallBottom = new WallBottom(GameObjectName.WallBottom, SpriteBaseName.Null, 448.0f, 50.0f, 850.0f, 30.0f, 0);
                pRootTree.Insert(pWallBottom, pWallRoot);
                if (areCollisionBoxesActive)
                {
                    pWallBottom.ActivateCollisionSprite(sbBoxes);
                }
                pWallBottom.ActivateGameSprite(sbAliens);
                GameObjectManager.AttachTree(pWallRoot);

                // Create ShipRoot and MissileRoot
                pMissileRoot = new MissileRoot(GameObjectName.MissileRoot, SpriteBaseName.Null, 0.0f, 0.0f, 0);
                pRootTree.Insert(pMissileRoot, null);
                if (areCollisionBoxesActive)
                {
                    pMissileRoot.ActivateCollisionSprite(sbBoxes);
                }
                GameObjectManager.AttachTree(pMissileRoot);
                pShipRoot = new ShipRoot(GameObjectName.ShipRoot, SpriteBaseName.Null, 0.0f, 0.0f);
                pRootTree.Insert(pShipRoot, null);
                if (areCollisionBoxesActive)
                {
                    pShipRoot.ActivateCollisionSprite(sbBoxes);
                }
                pShipRoot.ActivateGameSprite(sbAliens);
                GameObjectManager.AttachTree(pShipRoot);
                ShipManager.Create(areCollisionBoxesActive);

                // Create BombRoot
                pBombRoot = new BombRoot(GameObjectName.BombRoot, SpriteBaseName.Null, 0.0f, 0.0f, 0);
                pRootTree.Insert(pBombRoot, null);
                if (areCollisionBoxesActive)
                {
                    pBombRoot.ActivateCollisionSprite(sbBoxes);
                }
                GameObjectManager.AttachTree(pBombRoot);

                // Create UFORoot
                pUFORoot = new UFORoot(GameObjectName.UFORoot, SpriteBaseName.Null, 0.0f, 0.0f);
                pRootTree.Insert(pUFORoot, null);
                if (areCollisionBoxesActive)
                {
                    pUFORoot.ActivateCollisionSprite(sbBoxes);
                }
                pUFORoot.ActivateGameSprite(sbAliens);
                GameObjectManager.AttachTree(pUFORoot);
                UFOManager.Create(areCollisionBoxesActive);

                // Create Shields
                pShieldRoot1 = GenerateShield(pRootTree, 100.0f, 200.0f, 1);
                pShieldRoot2 = GenerateShield(pRootTree, 100.0f + 1 * 200, 200.0f, 2);
                pShieldRoot3 = GenerateShield(pRootTree, 100.0f + 2 * 200, 200.0f, 3);
                pShieldRoot4 = GenerateShield(pRootTree, 100.0f + 3 * 200, 200.0f, 4);
            }
            else
            {
                _gridStartingHeight -= 100.0f;
            }

            PopulateAlienGrid(_gridStartingHeight);
            Alien pGridRoot = (Alien)GameObjectManager.Find(GameObjectName.Grid);

            // Create CollisionPairs
            CollisionPair cpMissileWall = CollisionPairManager.Add(CollisionPairName.MissilevTop, pMissileRoot, pWallRoot);

            Debug.Assert(cpMissileWall != null);
            cpMissileWall.subject.RegisterObserver(new RemoveMissileObserver());
            cpMissileWall.subject.RegisterObserver(new ShipReadyObserver());

            CollisionPair cpBombWall = CollisionPairManager.Add(CollisionPairName.BombsvBottom, pBombRoot, pWallRoot);

            Debug.Assert(cpBombWall != null);
            cpBombWall.subject.RegisterObserver(new RemoveBombObserver());

            CollisionPair cpMissilevGrid = CollisionPairManager.Add(CollisionPairName.MissilevGrid, pMissileRoot, pGridRoot);

            Debug.Assert(cpMissilevGrid != null);
            cpMissilevGrid.subject.RegisterObserver(new RemoveMissileObserver());
            cpMissilevGrid.subject.RegisterObserver(new RemoveAlienObserver());
            cpMissilevGrid.subject.RegisterObserver(new ShipReadyObserver());
            cpMissilevGrid.subject.RegisterObserver(new AlienDeathSoundObserver());
            cpMissilevGrid.subject.RegisterObserver(new SplatObserver());
            cpMissilevGrid.subject.RegisterObserver(new UpdateScoreObserver());

            CollisionPair cpUFOMissile = CollisionPairManager.Add(CollisionPairName.MissilevUFO, pMissileRoot, pUFORoot);

            cpUFOMissile.subject.RegisterObserver(new RemoveMissileObserver());
            cpUFOMissile.subject.RegisterObserver(new RemoveUFOObserver());
            cpUFOMissile.subject.RegisterObserver(new ShipReadyObserver());
            cpUFOMissile.subject.RegisterObserver(new AlienDeathSoundObserver());
            cpUFOMissile.subject.RegisterObserver(new SplatObserver());
            cpUFOMissile.subject.RegisterObserver(new UpdateScoreObserver());
            cpUFOMissile.subject.RegisterObserver(new UFODeathSoundObserver());

            CollisionPair cpUFOWalls = CollisionPairManager.Add(CollisionPairName.UFOvWalls, pUFORoot, pWallRoot);

            cpUFOWalls.subject.RegisterObserver(new UFOWallObserver());

            CollisionPair cpGridvWalls = CollisionPairManager.Add(CollisionPairName.GridvWalls, pGridRoot, pWallRoot);

            Debug.Assert(cpGridvWalls != null);
            cpGridvWalls.subject.RegisterObserver(new GridXObserver());
            cpGridvWalls.subject.RegisterObserver(new GridYObserver());

            CollisionPair cpGridvShip = CollisionPairManager.Add(CollisionPairName.GridvShip, pGridRoot, pShipRoot);

            cpGridvShip.subject.RegisterObserver(new GameOverObserver());
            cpGridvShip.subject.RegisterObserver(new ShipDeathSoundObserver());

            CollisionPair cpMissileShield1 = CollisionPairManager.Add(CollisionPairName.MissilevShields, pMissileRoot, pShieldRoot1);

            cpMissileShield1.subject.RegisterObserver(new RemoveMissileObserver());
            cpMissileShield1.subject.RegisterObserver(new RemoveBrickObserver());
            cpMissileShield1.subject.RegisterObserver(new ShipReadyObserver());
            CollisionPair cpBombShield1 = CollisionPairManager.Add(CollisionPairName.BombsvShields, pBombRoot, pShieldRoot1);

            cpBombShield1.subject.RegisterObserver(new RemoveBombObserver());
            cpBombShield1.subject.RegisterObserver(new RemoveBrickObserver());

            CollisionPair cpMissileShield2 = CollisionPairManager.Add(CollisionPairName.MissilevShields, pMissileRoot, pShieldRoot2);

            cpMissileShield2.subject.RegisterObserver(new RemoveMissileObserver());
            cpMissileShield2.subject.RegisterObserver(new RemoveBrickObserver());
            cpMissileShield2.subject.RegisterObserver(new ShipReadyObserver());
            CollisionPair cpBombShield2 = CollisionPairManager.Add(CollisionPairName.BombsvShields, pBombRoot, pShieldRoot2);

            cpBombShield2.subject.RegisterObserver(new RemoveBombObserver());
            cpBombShield2.subject.RegisterObserver(new RemoveBrickObserver());

            CollisionPair cpBombShield3 = CollisionPairManager.Add(CollisionPairName.BombsvShields, pBombRoot, pShieldRoot3);

            cpBombShield3.subject.RegisterObserver(new RemoveBombObserver());
            cpBombShield3.subject.RegisterObserver(new RemoveBrickObserver());
            CollisionPair cpMissileShield3 = CollisionPairManager.Add(CollisionPairName.MissilevShields, pMissileRoot, pShieldRoot3);

            cpMissileShield3.subject.RegisterObserver(new RemoveMissileObserver());
            cpMissileShield3.subject.RegisterObserver(new RemoveBrickObserver());
            cpMissileShield3.subject.RegisterObserver(new ShipReadyObserver());

            CollisionPair cpBombShield4 = CollisionPairManager.Add(CollisionPairName.BombsvShields, pBombRoot, pShieldRoot4);

            cpBombShield4.subject.RegisterObserver(new RemoveBombObserver());
            cpBombShield4.subject.RegisterObserver(new RemoveBrickObserver());
            CollisionPair cpMissileShield4 = CollisionPairManager.Add(CollisionPairName.MissilevShields, pMissileRoot, pShieldRoot4);

            cpMissileShield4.subject.RegisterObserver(new RemoveMissileObserver());
            cpMissileShield4.subject.RegisterObserver(new RemoveBrickObserver());
            cpMissileShield4.subject.RegisterObserver(new ShipReadyObserver());

            CollisionPair cpBombMissile = CollisionPairManager.Add(CollisionPairName.BombsvMissile, pBombRoot, pMissileRoot);

            cpBombMissile.subject.RegisterObserver(new RemoveBombObserver());
            cpBombMissile.subject.RegisterObserver(new RemoveMissileObserver());
            cpBombMissile.subject.RegisterObserver(new ShipReadyObserver());
            cpBombMissile.subject.RegisterObserver(new SplatObserver());

            CollisionPair cpBombShip = CollisionPairManager.Add(CollisionPairName.BombsvShip, pBombRoot, pShipRoot);

            cpBombShip.subject.RegisterObserver(new RemoveBombObserver());
            cpBombShip.subject.RegisterObserver(new RemoveShipObserver());
            cpBombShip.subject.RegisterObserver(new ShipDeathSoundObserver());
            cpBombShip.subject.RegisterObserver(new ShipEndObserver());

            //TimerManager.ClearTimerManager();
        }
 public override void VisitWallRoot(WallRoot w)
 {
     Debug.WriteLine("ShipRoot WallRoot");
     CollisionPair.detectCollision((GameObject)this.pChild, w);
 }
Beispiel #11
0
 // Walls
 public override void VisitWallRoot(WallRoot w)
 {
     // Debug.WriteLine("StraightMissile WallRoot");
     CollisionPair.detectCollision(this, (GameObject)w.pChild);
 }
Beispiel #12
0
 public override void VisitWallRoot(WallRoot pWallRoot)
 {
     CollisionPair.Collide(this, (GameObject)pWallRoot.pChild);
 }
 //----------------------Wall visits---------------------------------------
 public override void VisitWallRoot(WallRoot w)
 {
     //  Debug.WriteLine("AlienGrid WallRoot");
     // CollisionPair.detectCollision(w, (GameObject)this.pChild);//chnaged this to fix grid
     CollisionPair.detectCollision(this, (GameObject)w.pChild);
 }
        // Wall

        public virtual void VisitWallRoot(WallRoot w)
        {
        }
Beispiel #15
0
        //This loadContent is called in the actual Game.cs
        //So its done before the player even presses input
        // and only called once
        public override void LoadContent()
        {
            //---------------------------------------------------------------------------------------------------------
            // Create Managers
            //---------------------------------------------------------------------------------------------------------

            TextureMan.Create(6, 1);
            ImageMan.Create(25, 2);
            GameSpriteMan.Create(20, 1);

            //i'm grossly inefficient at this point
            //------------------------------------------------
            BoxSpriteMan.Create(200, 100);
            ProxySpriteMan.Create(200, 100);
            //-------------------------------------------------
            SpriteBatchMan.Create(8, 1);
            GlyphMan.Create();
            FontMan.Create(12, 1);

            GONodeMan.Create(10, 3);
            TimerMan.Create(7, 3);
            ColPairMan.Create(16, 1);

            //Experimental managers
            AnimMan.Create(3, 1);
            Simulation.Create();
            PlayerMan.Create();

            SpaceInvaders pGame = GameMan.GetGame();

            IrrKlang.ISoundEngine pSndEngine = pGame.GetSndEngine();


            //---------------------------------------------------------------------------------------------------------
            // Load the Textures and Font {Consolas20pt}
            //---------------------------------------------------------------------------------------------------------

            TextureMan.Add(Texture.Name.Aliens14x14, "aliens14x14.tga");
            TextureMan.Add(Texture.Name.Aliens, "SpaceInvadersSprites.tga");

            TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");
            TextureMan.Add(Texture.Name.Consolas20pt, "Consolas20pt.tga");

            FontMan.AddXml(Glyph.Name.Consolas20pt, "Consolas20pt.xml", Texture.Name.Consolas20pt);
            FontMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);



            //---------------------------------------------------------------------------------------------------------
            // Load Images
            //---------------------------------------------------------------------------------------------------------

            ImageMan.Add(Image.Name.CrabU, Texture.Name.Aliens14x14, 318, 180, 160, 116);
            ImageMan.Add(Image.Name.CrabD, Texture.Name.Aliens14x14, 318, 24, 160, 116);
            ImageMan.Add(Image.Name.OctopusU, Texture.Name.Aliens14x14, 610, 25, 122, 115);
            ImageMan.Add(Image.Name.OctopusD, Texture.Name.Aliens14x14, 610, 180, 119, 112);
            ImageMan.Add(Image.Name.SquidU, Texture.Name.Aliens14x14, 51, 24, 175, 116);
            ImageMan.Add(Image.Name.SquidD, Texture.Name.Aliens14x14, 51, 180, 175, 110);

            ImageMan.Add(Image.Name.Ship, Texture.Name.Aliens14x14, 52, 336, 194, 114);
            ImageMan.Add(Image.Name.UFO, Texture.Name.Aliens14x14, 81, 502, 229, 98);
            ImageMan.Add(Image.Name.Missile, Texture.Name.Aliens14x14, 378, 798, 14, 98);

            ImageMan.Add(Image.Name.AlienSplat, Texture.Name.Aliens14x14, 573, 490, 183, 110);
            ImageMan.Add(Image.Name.ShipSplat, Texture.Name.Aliens, 651, 942, 117, 72);
            ImageMan.Add(Image.Name.BombSplat, Texture.Name.Aliens, 350, 90, 49, 72);
            ImageMan.Add(Image.Name.UFOSplat, Texture.Name.Aliens, 224, 230, 187, 77);

            ImageMan.Add(Image.Name.BombStraight, Texture.Name.Aliens, 216, 94, 16, 56);
            ImageMan.Add(Image.Name.BombZigZag, Texture.Name.Aliens, 349, 161, 23, 59);
            ImageMan.Add(Image.Name.BombCross, Texture.Name.Aliens, 210, 163, 30, 48);

            ImageMan.Add(Image.Name.Brick, Texture.Name.Aliens, 50, 120, 20, 10);
            ImageMan.Add(Image.Name.BrickLeft_Top1, Texture.Name.Aliens, 40, 100, 20, 10);
            ImageMan.Add(Image.Name.BrickLeft_Top2, Texture.Name.Aliens, 40, 110, 20, 10);
            ImageMan.Add(Image.Name.BrickLeft_Bottom, Texture.Name.Aliens, 75, 190, 15, 10);
            ImageMan.Add(Image.Name.BrickRight_Top1, Texture.Name.Aliens, 189, 125, 20, 10);
            ImageMan.Add(Image.Name.BrickRight_Top2, Texture.Name.Aliens, 186, 126, 20, 10);
            ImageMan.Add(Image.Name.BrickRight_Bottom, Texture.Name.Aliens, 130, 190, 20, 10);


            //---------------------------------------------------------------------------------------------------------
            // Create Sprites
            //---------------------------------------------------------------------------------------------------------

            GameSpriteMan.Add(GameSprite.Name.UFO, Image.Name.UFO, 400, 550, 50.0f, 25.0f);
            GameSpriteMan.Add(GameSprite.Name.Ship, Image.Name.Ship, 400, 25, 40.0f, 25.0f);

            GameSpriteMan.Add(GameSprite.Name.Crab, Image.Name.CrabU, 700, 480, 35, 20);
            GameSpriteMan.Add(GameSprite.Name.Squid, Image.Name.SquidU, 325, 350, 35, 20);
            GameSpriteMan.Add(GameSprite.Name.Octopus, Image.Name.OctopusU, 260, 350, 25, 20);

            GameSpriteMan.Add(GameSprite.Name.AlienSplat, Image.Name.AlienSplat, 50, 50, 30, 20);
            GameSpriteMan.Add(GameSprite.Name.ShipSplat, Image.Name.ShipSplat, 50, 50, 40, 25);
            GameSpriteMan.Add(GameSprite.Name.UFOsplat, Image.Name.UFOSplat, 50, 50, 50, 25);
            GameSpriteMan.Add(GameSprite.Name.BombSplat, Image.Name.BombSplat, 50, 50, 10, 15);

            GameSpriteMan.Add(GameSprite.Name.Missile, Image.Name.Missile, 100, 100, 5.0f, 15.0f);
            GameSpriteMan.Add(GameSprite.Name.BombZigZag, Image.Name.BombZigZag, 200, 200, 10, 20);
            GameSpriteMan.Add(GameSprite.Name.BombStraight, Image.Name.BombStraight, 100, 100, 5, 20);
            GameSpriteMan.Add(GameSprite.Name.BombDagger, Image.Name.BombCross, 100, 100, 10, 20);

            GameSpriteMan.Add(GameSprite.Name.Brick, Image.Name.Brick, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop1, Image.Name.BrickLeft_Top1, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop2, Image.Name.BrickLeft_Top2, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_LeftBottom, Image.Name.BrickLeft_Bottom, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_RightTop1, Image.Name.BrickRight_Top1, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_RightTop2, Image.Name.BrickRight_Top2, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_RightBottom, Image.Name.BrickRight_Bottom, 50, 25, 10, 5);


            //------------------------------------------------------------------------------------------
            //Attaching the sprites/batches
            //------------------------------------------------------------------------------------------

            SpriteBatch pSB_Intro = SpriteBatchMan.Add(SpriteBatch.Name.IntroScreen);


            SpriteBatch pSB_Aliens = SpriteBatchMan.Add(SpriteBatch.Name.Aliens);

            pSB_Aliens.bToggle = false;

            SpriteBatch pSB_Boxes = SpriteBatchMan.Add(SpriteBatch.Name.Boxes);

            SpriteBatch pSB_Shields = SpriteBatchMan.Add(SpriteBatch.Name.Shields);

            pSB_Shields.bToggle = false;

            SpriteBatch pSB_InGame = SpriteBatchMan.Add(SpriteBatch.Name.InGameScreen);

            pSB_InGame.bToggle = false;

            SpriteBatch pSB_Projectiles = SpriteBatchMan.Add(SpriteBatch.Name.Projectiles);

            pSB_Projectiles.bToggle = false;

            SpriteBatch pSB_GameOver = SpriteBatchMan.Add(SpriteBatch.Name.GameOver);

            pSB_GameOver.bToggle = false;

            //SpriteBatch pSB_Splats = SpriteBatchMan.Add(SpriteBatch.Name.Splats);
            //pSB_Splats.bToggle = false;

            //---------------------------------------------------------------------------------------------------------
            // Font
            //---------------------------------------------------------------------------------------------------------

            FontMan.Add(Font.Name.Title, SpriteBatch.Name.IntroScreen, "Space Invaders", Glyph.Name.Consolas36pt, 200, 700);
            FontMan.Add(Font.Name.NumOfPlayers, SpriteBatch.Name.IntroScreen, "Press 1 for Single Player", Glyph.Name.Consolas36pt, 120, 650);
            FontMan.Add(Font.Name.ShootButton, SpriteBatch.Name.IntroScreen, "Space <Bar> To Shoot", Glyph.Name.Consolas36pt, 140, 580);
            FontMan.Add(Font.Name.MoveButtons, SpriteBatch.Name.IntroScreen, "Left and Right Arrows To Move", Glyph.Name.Consolas36pt, 60, 540);
            FontMan.Add(Font.Name.SquidScore, SpriteBatch.Name.IntroScreen, "Squid = 30 points", Glyph.Name.Consolas36pt, 200, 480);
            FontMan.Add(Font.Name.CrabScore, SpriteBatch.Name.IntroScreen, "Crab = 40 points", Glyph.Name.Consolas36pt, 200, 440);
            FontMan.Add(Font.Name.OctoScore, SpriteBatch.Name.IntroScreen, "Octo = 50 points", Glyph.Name.Consolas36pt, 200, 400);
            FontMan.Add(Font.Name.UFOScore, SpriteBatch.Name.IntroScreen, "UFO = 100 points", Glyph.Name.Consolas36pt, 200, 360);
            FontMan.Add(Font.Name.TBD, SpriteBatch.Name.IntroScreen, "2 Player Coming Soon!", Glyph.Name.Consolas36pt, 160, 300);


            FontMan.Add(Font.Name.ScoreP1, SpriteBatch.Name.InGameScreen, "<P1 Score>", Glyph.Name.Consolas36pt, 20, 720);
            FontMan.Add(Font.Name.LivesP1, SpriteBatch.Name.InGameScreen, "P1 Lives:", Glyph.Name.Consolas36pt, 20, 20);
            FontMan.Add(Font.Name.P1Points, SpriteBatch.Name.InGameScreen, "0", Glyph.Name.Consolas36pt, 20, 680);

            FontMan.Add(Font.Name.HiScore, SpriteBatch.Name.InGameScreen, "<HiScore>", Glyph.Name.Consolas36pt, 230, 720);
            FontMan.Add(Font.Name.HiPoints, SpriteBatch.Name.InGameScreen, "0", Glyph.Name.Consolas36pt, 250, 680);

            FontMan.Add(Font.Name.ScoreP2, SpriteBatch.Name.InGameScreen, "<P2 Score>", Glyph.Name.Consolas36pt, 425, 720);
            FontMan.Add(Font.Name.LivesP2, SpriteBatch.Name.InGameScreen, "P2 Lives:", Glyph.Name.Consolas36pt, 400, 20);
            FontMan.Add(Font.Name.P2Points, SpriteBatch.Name.InGameScreen, "0", Glyph.Name.Consolas36pt, 400, 680);

            FontMan.Add(Font.Name.GameOver, SpriteBatch.Name.GameOver, "Game, Set and Match", Glyph.Name.Consolas36pt, 100, 450);
            FontMan.Add(Font.Name.Credits, SpriteBatch.Name.GameOver, "Created By: James Corcoran", Glyph.Name.Consolas36pt, 100, 350);
            FontMan.Add(Font.Name.Thankyou, SpriteBatch.Name.GameOver, "Thanks for Playing!!!", Glyph.Name.Consolas36pt, 100, 250);

            //----------------------------------------------------------------------
            //Missile
            //----------------------------------------------------------------------

            MissileGroup pMissileGroup = new MissileGroup(GameObject.Name.MissileGroup, GameSprite.Name.NullObject, 0, 0.0f, 0.0f);

            pMissileGroup.ActivateGameSprite(pSB_Projectiles);
            pMissileGroup.ActivateCollisionSprite(pSB_Boxes);

            GONodeMan.Attach(pMissileGroup);


            Debug.WriteLine("-------------------");
            pMissileGroup.Print();

            //----------------------------------------------------------------------
            //Ship
            //----------------------------------------------------------------------

            ShipRoot pShipRoot = new ShipRoot(GameObject.Name.ShipRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            GONodeMan.Attach(pShipRoot);

            Debug.WriteLine("-------------------");
            pShipRoot.Print();

            //----------------------------------------------------------------------
            //UFO
            //----------------------------------------------------------------------

            UFORoot pUFORoot = new UFORoot(GameObject.Name.UFORoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            GONodeMan.Attach(pUFORoot);

            Debug.WriteLine("-------------------");
            pUFORoot.Print();

            //---------------------------------------------------------------------------------------------------------
            // Bomb
            //---------------------------------------------------------------------------------------------------------

            BombRoot pBombRoot = new BombRoot(GameObject.Name.BombRoot, GameSprite.Name.NullObject, -100.0f, -100.0f);

            GONodeMan.Attach(pBombRoot);

            Debug.WriteLine("-------------------");
            pBombRoot.Print();

            //---------------------------------------------------------------------
            //Wall Creation
            //---------------------------------------------------------------------

            WallRoot pTWallRoot = new WallRoot(GameObject.Name.WallRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            GONodeMan.Attach(pTWallRoot);

            TopWall pTWall = new TopWall(GameObject.Name.TopWall, GameSprite.Name.NullObject, 336, 748, 600, 40);

            pTWall.ActivateCollisionSprite(pSB_Boxes);
            pTWallRoot.Add(pTWall);

            WallRoot pLWallRoot = new WallRoot(GameObject.Name.WallRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            GONodeMan.Attach(pLWallRoot);

            LeftWall pLWall = new LeftWall(GameObject.Name.LeftWall, GameSprite.Name.NullObject, 20, 384, 40, 700);

            pLWall.ActivateCollisionSprite(pSB_Boxes);
            pLWallRoot.Add(pLWall);

            WallRoot pRWallRoot = new WallRoot(GameObject.Name.WallRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            GONodeMan.Attach(pRWallRoot);

            RightWall pRWall = new RightWall(GameObject.Name.RightWall, GameSprite.Name.NullObject, 653, 384, 40, 700);

            pRWall.ActivateCollisionSprite(pSB_Boxes);
            pRWallRoot.Add(pRWall);

            WallRoot pBWallRoot = new WallRoot(GameObject.Name.WallRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            GONodeMan.Attach(pBWallRoot);

            BottomWall pBWall = new BottomWall(GameObject.Name.BottomWall, GameSprite.Name.NullObject, 336, 20, 700, 40);

            pBWall.ActivateCollisionSprite(pSB_Boxes);
            pBWallRoot.Add(pBWall);

            Debug.WriteLine("-------------------");

            //---------------------------------------------------------------------
            //AlienRoot(Group) and ShieldRoot
            //---------------------------------------------------------------------

            Composite pAlienGroup = new AlienGroup(GameObject.Name.AlienGrid, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pAlienGroup.ActivateCollisionSprite(pSB_Boxes);
            GONodeMan.Attach(pAlienGroup);


            Composite pShieldRoot = new ShieldRoot(GameObject.Name.ShieldRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            GONodeMan.Attach(pShieldRoot);


            //Composite pSplatRoot = new SplatRoot(GameObject.Name.SplatRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);
            //GONodeMan.Attach(pSplatRoot);

            //--------------------------------------------------------------------------
            // Collision Pair
            //--------------------------------------------------------------------------

            ColPair pGrid_V_LWall = ColPairMan.Add(ColPair.Name.Aliens_V_LWall, pAlienGroup, pLWallRoot);

            Debug.Assert(pGrid_V_LWall != null);
            pGrid_V_LWall.Attach(new GridObserver());

            ColPair pGrid_V_RWall = ColPairMan.Add(ColPair.Name.Aliens_V_RWall, pAlienGroup, pRWallRoot);

            Debug.Assert(pGrid_V_RWall != null);
            pGrid_V_RWall.Attach(new GridObserver());

            ColPair pGrid_V_BWall = ColPairMan.Add(ColPair.Name.Aliens_V_BWall, pAlienGroup, pBWallRoot);

            Debug.Assert(pGrid_V_BWall != null);
            pGrid_V_BWall.Attach(new GridObserver());

            ColPair pMissile_V_Alien = ColPairMan.Add(ColPair.Name.Missile_V_Alien, pMissileGroup, pAlienGroup);

            Debug.Assert(pMissile_V_Alien != null);
            pMissile_V_Alien.Attach(new SplatObserver());
            pMissile_V_Alien.Attach(new RemoveAlienObserver());
            pMissile_V_Alien.Attach(new RemoveMissileObserver());
            pMissile_V_Alien.Attach(new ShipReadyObserver());
            pMissile_V_Alien.Attach(new SndObserver(pSndEngine, "invaderkilled.wav"));


            ColPair pAlien_V_Shield = ColPairMan.Add(ColPair.Name.Aliens_V_Shield, pAlienGroup, pShieldRoot);

            Debug.Assert(pAlien_V_Shield != null);
            pAlien_V_Shield.Attach(new RemoveBrickObserver());
            //pAlien_V_Shield.Attach(new SndObserver(pSndEngine, "explosion.wav"));

            ColPair pAlien_V_Ship = ColPairMan.Add(ColPair.Name.Aliens_V_Ship, pAlienGroup, pShipRoot);

            Debug.Assert(pAlien_V_Ship != null);
            pAlien_V_Ship.Attach(new SplatShipObserver());
            pAlien_V_Ship.Attach(new HitShipObserver());
            pAlien_V_Ship.Attach(new SndObserver(pSndEngine, "explosion.wav"));
            pAlien_V_Ship.Attach(new P1GameOverObs());

            //--------------------------------------------------------------------------------------------------------------

            ColPair pCollide_UFO_RWall = ColPairMan.Add(ColPair.Name.UFO_V_RWall, pUFORoot, pRWallRoot);

            Debug.Assert(pCollide_UFO_RWall != null);
            pCollide_UFO_RWall.Attach(new MissedUFOobserver());
            pCollide_UFO_RWall.Attach(new RemoveSndUFO());

            ColPair pCollide_UFO_LWall = ColPairMan.Add(ColPair.Name.UFO_V_LWall, pUFORoot, pLWallRoot);

            Debug.Assert(pCollide_UFO_LWall != null);
            pCollide_UFO_LWall.Attach(new MissedUFOobserver());
            pCollide_UFO_LWall.Attach(new RemoveSndUFO());

            ColPair pCollide_Missile_V_UFO = ColPairMan.Add(ColPair.Name.Missile_V_UFO, pMissileGroup, pUFORoot);

            Debug.Assert(pCollide_Missile_V_UFO != null);
            pCollide_Missile_V_UFO.Attach(new RemoveMissileObserver());
            pCollide_Missile_V_UFO.Attach(new RemoveUFOobserver());
            pCollide_Missile_V_UFO.Attach(new ShipReadyObserver());
            pCollide_Missile_V_UFO.Attach(new UFOSplatObs());
            pCollide_Missile_V_UFO.Attach(new SndObserver(pSndEngine, "invaderkilled.wav"));
            pCollide_Missile_V_UFO.Attach(new RemoveSndUFO());

            //-----------------------------------------------------------------------------------------------------------------
            ColPair pMissile_V_TWall = ColPairMan.Add(ColPair.Name.Missile_V_TWall, pMissileGroup, pTWallRoot);

            Debug.Assert(pMissile_V_TWall != null);
            pMissile_V_TWall.Attach(new ShipReadyObserver());
            pMissile_V_TWall.Attach(new RemoveMissileObserver());

            ColPair pBomb_V_Wall = ColPairMan.Add(ColPair.Name.Bomb_V_Wall, pBombRoot, pBWallRoot);

            Debug.Assert(pBomb_V_Wall != null);
            pBomb_V_Wall.Attach(new BombObserver());

            ColPair pMissile_V_Shield = ColPairMan.Add(ColPair.Name.Missile_V_Shield, pMissileGroup, pShieldRoot);

            Debug.Assert(pMissile_V_Shield != null);
            pMissile_V_Shield.Attach(new RemoveBrickObserver());
            pMissile_V_Shield.Attach(new RemoveMissileObserver());
            pMissile_V_Shield.Attach(new ShipReadyObserver());
            pMissile_V_Shield.Attach(new SndObserver(pSndEngine, "explosion.wav"));

            ColPair pBomb_V_Shield = ColPairMan.Add(ColPair.Name.Bomb_V_Shield, pBombRoot, pShieldRoot);

            Debug.Assert(pBomb_V_Shield != null);
            pBomb_V_Shield.Attach(new RemoveBrickObserver());
            pBomb_V_Shield.Attach(new BombObserver());
            pBomb_V_Shield.Attach(new SndObserver(pSndEngine, "explosion.wav"));

            ColPair pBomb_V_Ship = ColPairMan.Add(ColPair.Name.Ship_V_Bomb, pBombRoot, pShipRoot);

            Debug.Assert(pBomb_V_Ship != null);
            pBomb_V_Ship.Attach(new SplatShipObserver());
            pBomb_V_Ship.Attach(new BombObserver());
            pBomb_V_Ship.Attach(new HitShipObserver());
            pBomb_V_Ship.Attach(new SndObserver(pSndEngine, "explosion.wav"));
            pBomb_V_Ship.Attach(new P1GameOverObs());


            ColPair pBomb_V_Missile = ColPairMan.Add(ColPair.Name.Bomb_V_Missile, pBombRoot, pMissileGroup);

            Debug.Assert(pBomb_V_Missile != null);
            pBomb_V_Missile.Attach(new BombSplatObs());
            pBomb_V_Missile.Attach(new BombMissileObserver());
            pBomb_V_Missile.Attach(new SndObserver(pSndEngine, "explosion.wav"));
            pBomb_V_Missile.Attach(new ShipReadyObserver());
            //------------------------------------------------------------------------------------------------------------------

            ColPair pShip_V_LWall = ColPairMan.Add(ColPair.Name.Ship_V_LWall, pShipRoot, pLWallRoot);

            Debug.Assert(pShip_V_LWall != null);
            pShip_V_LWall.Attach(new ShipMovementObserver());

            ColPair pShip_V_RWall = ColPairMan.Add(ColPair.Name.Ship_V_RWall, pShipRoot, pRWallRoot);

            Debug.Assert(pShip_V_RWall != null);
            pShip_V_RWall.Attach(new ShipMovementObserver());

            //----------------------------------------------------------------------------------------------------------
            //Animate Sprites and Movement Commands
            //----------------------------------------------------------------------------------------------------------

            //Tests on my Animation Manager
            AnimateCrab pAnimS1 = new AnimateCrab(Animation.Name.AnimateCrab, GameSprite.Name.Crab);

            pAnimS1.Attach(Image.Name.CrabD);
            pAnimS1.Attach(Image.Name.CrabU);

            AnimateSquid pAnimS2 = new AnimateSquid(Animation.Name.AnimateSquid, GameSprite.Name.Squid);

            pAnimS2.Attach(Image.Name.SquidD);
            pAnimS2.Attach(Image.Name.SquidU);

            AnimateOcto pAnimS3 = new AnimateOcto(Animation.Name.AnimateOcto, GameSprite.Name.Octopus);

            pAnimS3.Attach(Image.Name.OctopusD);
            pAnimS3.Attach(Image.Name.OctopusU);

            AnimMan.Attach(pAnimS1);
            AnimMan.Attach(pAnimS2);
            AnimMan.Attach(pAnimS3);

            //---------------------------------------------------------------------------------------------------------
            //Add Input
            //---------------------------------------------------------------------------------------------------------
            InputSubject pInputSubject;

            pInputSubject = InputManager.GetArrowRightSubject();
            pInputSubject.Attach(new MoveRightObserver());

            pInputSubject = InputManager.GetArrowLeftSubject();
            pInputSubject.Attach(new MoveLeftObserver());

            pInputSubject = InputManager.GetSpaceBarSubject();
            pInputSubject.Attach(new ShootObserver());

            //first player
            pInputSubject = InputManager.Get1keySubject();
            pInputSubject.Attach(new Player1Observer());

            //add second player observer
            pInputSubject = InputManager.Get2keySubject();
            pInputSubject.Attach(new Player2Observer());


            pInputSubject = InputManager.GetCkeySubject();
            pInputSubject.Attach(new ToggleColObserver());


            //Simulator
            //I am testing because i think we will need to pause the game
            //for the timer manager and the lives for the ship
            Simulation.SetState(Simulation.State.RealTime);
        }