Beispiel #1
0
        public static void UpdateHiScore()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            //thinking...........
            //get player 1 score
            //get player 2 score

            float fP1Score = pPMan.player1Score;
            float fP2Score = pPMan.player2Score;

            float fHiScore = pPMan.fHiScore;

            //check if either Score is higher than hiScore
            if (fP1Score >= fHiScore)
            {
                //if one of them is then update the new hiScore
                pPMan.fHiScore = fP1Score;
            }

            else if (fP2Score >= fHiScore)
            {
                //if one of them is then update the new hiScore
                pPMan.fHiScore = fP2Score;
            }

            else
            {
                // no one got better than highScore
            }
        }
        public override void Handle()
        {
            SpriteBatch pGameOverScreen = SpriteBatchMan.Find(SpriteBatch.Name.GameOver);

            pGameOverScreen.bToggle = true;

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

            pSB_Aliens.bToggle = false;

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

            pSB_Shields.bToggle = false;

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

            pSB_InGame.bToggle = false;

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

            pSB_Projectiles.bToggle = false;

            PlayerMan.UpdateHiScore();
            PlayerMan.ClearStuff();
        }
Beispiel #3
0
        public static float GetP2Score()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            return(pPMan.player1Score);
        }
Beispiel #4
0
        public static void P2TakeLife()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            pPMan.player2Score -= 1;
        }
Beispiel #5
0
        public static float GetP2Lives()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            return(pPMan.player2Lives);
        }
Beispiel #6
0
        public static Player GetCurrentPlayer()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            return(pPMan.CurrentPlayer);
        }
Beispiel #7
0
        //--------------------------------------------------
        //Player 2
        //--------------------------------------------------

        public static void SetP2Score(float points)
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            pPMan.player1Score += points;
        }
Beispiel #8
0
        public static void P1TakeLife()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            pPMan.player1Lives -= 1;
        }
Beispiel #9
0
 override public void Notify(float xCurs, float yCurs)
 {
     if (ColRect.Intersect(this.pFont.pFontSprite.pColRect, new ColRect(xCurs, yCurs, 1, 1)))
     {
         PlayerMan.SetNPlayers(2);
         SceneContext.SetState(SceneContext.Scene.MultiPlay);
         SoundMan.PlaySound(Sound.Name.Shoot);
     }
 }
Beispiel #10
0
        public static void Create()
        {
            Debug.Assert(instance == null);

            if (instance == null)
            {
                instance = new PlayerMan();
            }

            Debug.Assert(instance != null);
        }
Beispiel #11
0
        public static void ClearStuff()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            pPMan.player1Lives = 3;
            pPMan.player1Score = 0;

            pPMan.player2Lives = 3;
            pPMan.player2Score = 0;
        }
Beispiel #12
0
        //public override void VisitMissileGroup(MissileGroup m)
        //{
        //    //Debug.WriteLine("collide: {0}<->{1}", m.GetName(), this.GetName());

        //    //go to the missile object
        //    //check the missile v. "this" UFO
        //    GameObject pGameObject = (GameObject)Iterator.GetChild(m);
        //    ColPair.Collide(pGameObject, this);
        //}

        public override void VisitMissile(Missile m)
        {
            //Debug.WriteLine("         collide:  {0} <-> {1}", m.GetName(), this.GetName());

            //Debug.WriteLine("-------> BOOM!  <--------");

            //add the points here.... because UFO can be removed if it hits a wall
            //this ensures that it was hit by a missile
            PlayerMan.SetP1Score(100);

            ColPair pColPair = ColPairMan.GetActiveColPair();

            //alphabetical ordering
            pColPair.SetCollision(m, this);
            pColPair.NotifyListeners();
        }
        public override void Notify()
        {
            // we need to revert lvl1 or lvl2 to original forms
            // because we lost and will need to re-load content

            //ship was hit take a life and subtract from score

            PlayerMan.P1TakeLife();
            PlayerMan.SetP1Score(-250);

            float P1lives = PlayerMan.GetP1Lives();

            SpaceInvaders pGame = GameMan.GetGame();

            //check if they have more lives
            if (P1lives == 0)
            {
                // last life i was stil able to shoot
                Ship pShip = ShipMan.GetShip();

                pShip.SetShootState(ShipMan.ShootState.End);
                pShip.SetMoveState(ShipMan.MoveState.NoMove);

                GameState pState = pGame.GetCurrentState();

                if (pState.GetStateName() == GameMan.State.InGame)
                {
                    InGameState pLvl1 = (InGameState)pState;
                    pLvl1.SetStateToggle(false);

                    TimerMan.Add(TimeEvent.Name.GameStateChange, new GameStateChange(false), 5.0f);
                }

                else if (pState.GetStateName() == GameMan.State.LVL2)
                {
                    InGameStateLV2 pLvl2 = (InGameStateLV2)pState;
                    pLvl2.SetStateToggle(false);

                    TimerMan.Add(TimeEvent.Name.GameStateChange, new GameStateChange(false), 5.0f);
                }
            }

            else
            {
                //do nothing
            }
        }
Beispiel #14
0
        public override void Update()
        {
            SpaceInvaders pGame = GameMan.GetGame();

            pGame.sndEngine.Update();

            InputManager.Update();

            Simulation.Update(pGame.GetTime());

            if (Simulation.GetTimeStep() > 0.0f)
            {
                //start timer
                TimerMan.Update(Simulation.GetTotalTime());

                //Update all the game objects(nodes)
                GONodeMan.Update();

                //check for collisions
                ColPairMan.Process();

                //process observers
                DelayedObjectMan.Process();
            }


            //---------------------------------------------------------------------------------------------------------
            // Font Practice
            //---------------------------------------------------------------------------------------------------------

            Font pScoreMessage = FontMan.Find(Font.Name.P1Points);

            Debug.Assert(pScoreMessage != null);
            pScoreMessage.UpdateMessage("" + (PlayerMan.GetP1Score()));

            Font pHiScore = FontMan.Find(Font.Name.HiPoints);

            Debug.Assert(pHiScore != null);
            pHiScore.UpdateMessage("" + PlayerMan.GetHiScore());

            Font pP1LivesLeft = FontMan.Find(Font.Name.LivesP1);

            Debug.Assert(pP1LivesLeft != null);
            pP1LivesLeft.UpdateMessage("P1 Lives: " + (PlayerMan.GetP1Lives()));
        }
        public override void Execute()
        {
            //GameObject pShipRoot = GONodeMan.Find(GameObject.Name.ShipRoot);

            GameObject pShipObject = (GameObject)this.pShip;

            this.pShip.Remove();

            //pShipRoot.Remove(this.pShip);


            float repairs = PlayerMan.GetP1Lives();

            if (repairs != 0)
            {
                TimerMan.Add(TimeEvent.Name.FixShip, new FixShip(), 1.0f);
            }
        }
Beispiel #16
0
        public static void SetCurrentPlayer(Player player)
        {
            PlayerMan pPlayerMan = PlayerMan.PrivInstance();

            Debug.Assert(pPlayerMan != null);



            switch (player)
            {
            case PlayerMan.Player.Player1:
                pPlayerMan.CurrentPlayer = Player.Player1;
                break;

            case PlayerMan.Player.Player2:
                pPlayerMan.CurrentPlayer = Player.Player2;
                break;

            default:
                Debug.Assert(false);
                break;
            }
        }
Beispiel #17
0
        public override void Notify()
        {
            //remove alien
            //Debug.WriteLine("RemoveAlienObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            //a little tricky ObjA is the missile, we are not alphabetical
            //because of how the missile observer is set up
            this.pAlien = (AlienCategory)this.pSubject.pObjB;
            Debug.Assert(this.pAlien != null);



            if (pAlien.bMarkForDeath == false)
            {
                pAlien.bMarkForDeath = true;

                if (pAlien.GetName() == GameObject.Name.Squid)
                {
                    PlayerMan.SetP1Score(30);
                }

                else if (pAlien.GetName() == GameObject.Name.Crab)
                {
                    PlayerMan.SetP1Score(40);
                }

                else
                {
                    PlayerMan.SetP1Score(50);
                }

                //pass brick reference to manager thats executes/removes objects later
                RemoveAlienObserver pObserver = new RemoveAlienObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
        public override void Execute()
        {
            GameObject pA = (GameObject)this.pAlien;
            GameObject pB = (GameObject)Iterator.GetParent(pA);

            float x = this.pAlien.x;
            float y = this.pAlien.y;

            AlienGrid pGrid = (AlienGrid)this.pAlien.pParent.pParent;

            pGrid.nNumActive--;

            pA.Remove();

            // TODO: Need a better way...
            if (privCheckParent(pB) == true)
            {
                GameObject pC = (GameObject)Iterator.GetParent(pB);
                pB.Remove();

                if (privCheckParent(pC) == true)
                {
                    pC.Remove();
                }
            }

            Missile pMissile = (Missile)this.pGameObj;
            Player  pPlayer  = pMissile.pPlayer;

            //
            Font.Name pFontName = Font.Name.Uninitialized;
            if (this.pGameObj is MissileCategory)
            {
                pPlayer.nPoints += this.pAlien.GetPoints();
                Font pScore = null;
                if (pPlayer.n == 1)
                {
                    pScore    = FontMan.Find(Font.Name.Score1Value);
                    pFontName = Font.Name.Score1Value;
                }
                if (pPlayer.n == 2)
                {
                    pScore    = FontMan.Find(Font.Name.Score2Value);
                    pFontName = Font.Name.Score2Value;
                }
                pScore.Set(pFontName,
                           pPlayer.nPoints.ToString(),
                           Glyph.Name.Consolas20pt,
                           pScore.pFontSprite.x,
                           pScore.pFontSprite.y);
            }

            //---------------------------------------------------------------------------------------------------------
            // Sound
            //---------------------------------------------------------------------------------------------------------
            SoundMan.PlaySound(Sound.Name.InvaderKilled);
            TimeEvent pTimeEvent = TimerMan.Find(TimeEvent.Name.ScenePlaySound);

            pTimeEvent.deltaTime -= 0.01f;

            //---------------------------------------------------------------------------------------------------------
            // Explosion
            //---------------------------------------------------------------------------------------------------------
            Explosion   explosion  = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, x, y);
            SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);

            explosion.ActivateGameSprite(pSB_Aliens);
            GameObjectMan.Attach(explosion);
            TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f);

            //---------------------------------------------------------------------------------------------------------
            // Scene Transition
            //---------------------------------------------------------------------------------------------------------
            if (pGrid.nNumActive == 0 && pPlayer.nCurrLevel == 1)
            {
                PlayerMan.WriteHighScores();
                pPlayer.nCurrLevel++;
                SceneContext.GetState().Initialize();
                if (SceneContext.bMultiplayer)
                {
                    SceneContext.SetState(SceneContext.Scene.MultiPlay);
                }
                else
                {
                    SceneContext.SetState(SceneContext.Scene.SinglePlay);
                }
            }
            else if (pGrid.nNumActive == 0 && pPlayer.nCurrLevel == 2)
            {
                PlayerMan.WriteHighScores();
                SceneContext.SetState(SceneContext.Scene.Credits);
            }
        }
Beispiel #19
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);
        }
Beispiel #20
0
 public override void Notify()
 {
     this.pAlienGrid = (AlienGrid)this.pSubject.pObjA;
     PlayerMan.WriteHighScores();
     SceneContext.SetState(SceneContext.Scene.Over);
 }
Beispiel #21
0
        public override void Initialize()
        {
            Random pRandom = new Random();

            //---------------------------------------------------------------------------------------------------------
            // Images
            //---------------------------------------------------------------------------------------------------------
            ImageMan.Add(Image.Name.BlueAlien, Texture.Name.Aliens, new Azul.Rect(341, 337, 65, 64));
            ImageMan.Add(Image.Name.BlueAlien2, Texture.Name.Aliens, new Azul.Rect(464, 65, 64, 63));
            ImageMan.Add(Image.Name.GreenAlien, Texture.Name.Aliens, new Azul.Rect(27, 337, 79, 64));
            ImageMan.Add(Image.Name.GreenAlien2, Texture.Name.Aliens, new Azul.Rect(253, 64, 84, 65));
            ImageMan.Add(Image.Name.RedAlien, Texture.Name.Aliens, new Azul.Rect(647, 200, 72, 65));
            ImageMan.Add(Image.Name.RedAlien2, Texture.Name.Aliens, new Azul.Rect(26, 201, 94, 65));
            ImageMan.Add(Image.Name.Explosion, Texture.Name.Aliens, new Azul.Rect(488, 488, 75, 48));
            ImageMan.Add(Image.Name.Explosion_Ground, Texture.Name.Aliens, new Azul.Rect(328, 489, 84, 48));
            ImageMan.Add(Image.Name.UFO, Texture.Name.Aliens, new Azul.Rect(120, 489, 98, 49));

            ImageMan.Add(Image.Name.Missile, Texture.Name.Aliens, new Azul.Rect(267, 501, 9, 34));
            ImageMan.Add(Image.Name.Ship, Texture.Name.Birds2, new Azul.Rect(9, 92, 31, 19));

            ImageMan.Add(Image.Name.Wall, Texture.Name.Birds, new Azul.Rect(40, 185, 20, 10));
            ImageMan.Add(Image.Name.WallBottom, Texture.Name.Birds, new Azul.Rect(40, 185, 20, 1));

            ImageMan.Add(Image.Name.BombStraight, Texture.Name.Birds, new Azul.Rect(110, 100, 7, 49));
            ImageMan.Add(Image.Name.BombZigZag, Texture.Name.Birds, new Azul.Rect(132, 100, 20, 50));
            ImageMan.Add(Image.Name.BombCross, Texture.Name.Birds, new Azul.Rect(219, 103, 19, 47));

            ImageMan.Add(Image.Name.Brick, Texture.Name.Birds, new Azul.Rect(20, 210, 10, 5));
            ImageMan.Add(Image.Name.BrickLeft_Top0, Texture.Name.Birds, new Azul.Rect(15, 180, 10, 5));
            ImageMan.Add(Image.Name.BrickLeft_Top1, Texture.Name.Birds, new Azul.Rect(15, 185, 10, 5));
            ImageMan.Add(Image.Name.BrickLeft_Bottom, Texture.Name.Birds, new Azul.Rect(35, 215, 10, 5));
            ImageMan.Add(Image.Name.BrickRight_Top0, Texture.Name.Birds, new Azul.Rect(75, 180, 10, 5));
            ImageMan.Add(Image.Name.BrickRight_Top1, Texture.Name.Birds, new Azul.Rect(75, 185, 10, 5));
            ImageMan.Add(Image.Name.BrickRight_Bottom, Texture.Name.Birds, new Azul.Rect(55, 215, 10, 5));

            //---------------------------------------------------------------------------------------------------------
            // Game Sprites
            //---------------------------------------------------------------------------------------------------------
            GameSpriteMan.Add(GameSprite.Name.BlueAlien, Image.Name.BlueAlien, 100, 150, 30, 30);
            GameSpriteMan.Add(GameSprite.Name.RedAlien, Image.Name.RedAlien, 200, 150, 30, 30);
            GameSpriteMan.Add(GameSprite.Name.GreenAlien, Image.Name.GreenAlien, 300, 150, 30, 30);
            GameSpriteMan.Add(GameSprite.Name.UFO, Image.Name.UFO, 120, 489, 70, 25);
            GameSpriteMan.Add(GameSprite.Name.Explosion_Ground, Image.Name.Explosion_Ground, 328, 489, 30, 20);
            GameSpriteMan.Add(GameSprite.Name.Explosion, Image.Name.Explosion, 120, 489, 30, 20);

            GameSpriteMan.Add(GameSprite.Name.Missile, Image.Name.Missile, -100, -100, 3, 12);
            GameSpriteMan.Add(GameSprite.Name.Ship, Image.Name.Ship, 500, 100, 50, 20);
            GameSpriteMan.Add(GameSprite.Name.ShipInactive, Image.Name.Ship, 500, 100, 50, 20);
            GameSpriteMan.Add(GameSprite.Name.Wall, Image.Name.Wall, 448, 900, 850, 30);
            GameSpriteMan.Add(GameSprite.Name.WallBottom, Image.Name.WallBottom, 448, 900, 850, 1);

            GameSpriteMan.Add(GameSprite.Name.BombZigZag, Image.Name.BombZigZag, 200, 200, 8, 25);
            GameSpriteMan.Add(GameSprite.Name.BombStraight, Image.Name.BombStraight, 110, 100, 8, 25);
            GameSpriteMan.Add(GameSprite.Name.BombDagger, Image.Name.BombCross, 100, 100, 8, 25);

            GameSpriteMan.Add(GameSprite.Name.Brick, Image.Name.Brick, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop0, Image.Name.BrickLeft_Top0, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop1, Image.Name.BrickLeft_Top1, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_LeftBottom, Image.Name.BrickLeft_Bottom, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_RightTop0, Image.Name.BrickRight_Top0, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_RightTop1, Image.Name.BrickRight_Top1, 50, 25, 10, 5);
            GameSpriteMan.Add(GameSprite.Name.Brick_RightBottom, Image.Name.BrickRight_Bottom, 50, 25, 10, 5);

            BoxSpriteMan.Add(BoxSprite.Name.Box1, 550.0f, 500.0f, 50.0f, 150.0f, new Azul.Color(1.0f, 1.0f, 1.0f, 1.0f));
            BoxSpriteMan.Add(BoxSprite.Name.Box2, 550.0f, 100.0f, 50.0f, 100.0f);

            this.poSpriteBatchMan = new SpriteBatchMan(3, 1);
            SpriteBatchMan.SetActive(this.poSpriteBatchMan);

            this.poGameObjectMan = new GameObjectMan(10, 2);
            GameObjectMan.SetActive(this.poGameObjectMan);

            this.poInputMan = new InputMan();
            InputMan.SetActive(this.poInputMan);

            this.poTimerMan = new TimerMan();
            TimerMan.SetActive(this.poTimerMan);

            //---------------------------------------------------------------------------------------------------------
            // SpriteBatches
            //---------------------------------------------------------------------------------------------------------
            SpriteBatch pSB_Box     = SpriteBatchMan.Add(SpriteBatch.Name.Boxes, 100, false);
            SpriteBatch pSB_Texts   = SpriteBatchMan.Add(SpriteBatch.Name.Texts, 100, true);
            SpriteBatch pSB_Shields = SpriteBatchMan.Add(SpriteBatch.Name.Shields, 100, true);
            SpriteBatch pSB_Aliens  = SpriteBatchMan.Add(SpriteBatch.Name.Aliens, 100, true);
            SpriteBatch pSB_Bombs   = SpriteBatchMan.Add(SpriteBatch.Name.Bombs, 100, true);

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

            GameObjectMan.Attach(pShipRoot);
            Ship pShip = ShipMan.CreateShip();

            //---------------------------------------------------------------------------------------------------------
            // Player
            //---------------------------------------------------------------------------------------------------------
            Player pPlayer = PlayerMan.GetCurrentPlayer(pShip);

            pShip.SetPlayer(pPlayer);

            //---------------------------------------------------------------------------------------------------------
            // Aliens
            //---------------------------------------------------------------------------------------------------------
            AlienFactory aF = new AlienFactory(SpriteBatch.Name.Aliens, SpriteBatch.Name.Boxes);
            // Do this somewhere else ..
            int yPos = 475;

            if (pPlayer.nCurrLevel == 2)
            {
                yPos -= 40;
            }
            AlienGrid pGrid      = aF.CreateGrid(200, yPos);
            float     pGridDelta = 0.2f;

            if (pPlayer.nCurrLevel == 2)
            {
                pGridDelta = 0.3f;
            }

            //---------------------------------------------------------------------------------------------------------
            // Missile
            //---------------------------------------------------------------------------------------------------------
            MissileGroup pMissileGroup = new MissileGroup(GameObject.Name.MissileGroup, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pMissileGroup.ActivateGameSprite(pSB_Aliens);
            GameObjectMan.Attach(pMissileGroup);

            //---------------------------------------------------------------------------------------------------------
            // Bomb
            //---------------------------------------------------------------------------------------------------------
            BombRoot pBombRoot = new BombRoot(GameObject.Name.BombRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pBombRoot.ActivateCollisionSprite(pSB_Box);
            pBombRoot.ActivateGameSprite(pSB_Bombs);
            GameObjectMan.Attach(pBombRoot);

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

            pInputSubject = InputMan.GetArrowRightSubject();
            pInputSubject.Attach(new MoveRightObserver(pShip));

            pInputSubject = InputMan.GetArrowLeftSubject();
            pInputSubject.Attach(new MoveLeftObserver(pShip));

            pInputSubject = InputMan.GetSpaceSubject();
            pInputSubject.Attach(new ShootObserver(pShip));

            pInputSubject = InputMan.GetPeriodSubject();
            pInputSubject.Attach(new ToggleRenderBoxSpriteObserver());

            pInputSubject = InputMan.GetCommaSubject();
            pInputSubject.Attach(new ToggleShieldBricksObserver());

            //---------------------------------------------------------------------------------------------------------
            // Walls
            //---------------------------------------------------------------------------------------------------------
            WallGroup pWallGroup = new WallGroup(GameObject.Name.WallGroup, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pWallGroup.ActivateGameSprite(pSB_Aliens);

            WallTop pWallTop = new WallTop(GameObject.Name.WallTop, GameSprite.Name.Wall, 400, 750, 700, 15);

            pWallTop.ActivateCollisionSprite(pSB_Aliens);

            WallBottom pWallBottom = new WallBottom(GameObject.Name.WallBottom, GameSprite.Name.WallBottom, 400, 30, 850, 1);

            pWallBottom.ActivateCollisionSprite(pSB_Box);
            pWallBottom.ActivateGameSprite(pSB_Aliens);

            WallLeft pWallLeft = new WallLeft(GameObject.Name.WallLeft, GameSprite.Name.Wall, 0, 300, 15, 600);

            pWallLeft.ActivateCollisionSprite(pSB_Box);

            WallRight pWallRight = new WallRight(GameObject.Name.WallRight, GameSprite.Name.Wall, 800, 300, 15, 600);

            pWallRight.ActivateCollisionSprite(pSB_Box);

            pWallGroup.Add(pWallTop);
            pWallGroup.Add(pWallBottom);
            pWallGroup.Add(pWallRight);
            pWallGroup.Add(pWallLeft);
            GameObjectMan.Attach(pWallGroup);

            //---------------------------------------------------------------------------------------------------------
            // Shield
            //---------------------------------------------------------------------------------------------------------
            ShieldFactory SF           = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Boxes, GameObject.Name.ShieldRoot1);
            Composite     pShieldRoot1 = SF.CreateShield(50.0f, 100.0f);

            GameObjectMan.Attach(pShieldRoot1);

            SF = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Boxes, GameObject.Name.ShieldRoot2);
            Composite pShieldRoot2 = SF.CreateShield(200.0f, 100.0f);

            GameObjectMan.Attach(pShieldRoot2);

            SF = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Boxes, GameObject.Name.ShieldRoot3);
            Composite pShieldRoot3 = SF.CreateShield(500.0f, 100.0f);

            GameObjectMan.Attach(pShieldRoot3);

            SF = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Boxes, GameObject.Name.ShieldRoot4);
            Composite pShieldRoot4 = SF.CreateShield(650.0f, 100.0f);

            GameObjectMan.Attach(pShieldRoot4);

            //---------------------------------------------------------------------------------------------------------
            // Collision Observers
            //---------------------------------------------------------------------------------------------------------
            ColPair pColPair;

            // Missile vs Wall
            pColPair = ColPairMan.Add(ColPair.Name.Missile_Wall, pMissileGroup, pWallGroup);
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new ShipReadyObserver(pShip));

            // Bomb vs Bottom
            pColPair = ColPairMan.Add(ColPair.Name.Bomb_Wall, pBombRoot, pWallGroup);
            pColPair.Attach(new RemoveBombObserver());

            // Bomb vs Missile
            pColPair = ColPairMan.Add(ColPair.Name.Bomb_Missile, pBombRoot, pMissileGroup);
            pColPair.Attach(new RemoveMissileAndBombObserver());
            pColPair.Attach(new ShipReadyObserver(pShip));

            // Bomb vs Shields
            pColPair = ColPairMan.Add(ColPair.Name.Bomb_Shield1, pBombRoot, pShieldRoot1);
            pColPair.Attach(new RemoveBombObserver());
            pColPair.Attach(new RemoveBrickObserver());

            pColPair = ColPairMan.Add(ColPair.Name.Bomb_Shield2, pBombRoot, pShieldRoot2);
            pColPair.Attach(new RemoveBombObserver());
            pColPair.Attach(new RemoveBrickObserver());

            pColPair = ColPairMan.Add(ColPair.Name.Bomb_Shield3, pBombRoot, pShieldRoot3);
            pColPair.Attach(new RemoveBombObserver());
            pColPair.Attach(new RemoveBrickObserver());

            pColPair = ColPairMan.Add(ColPair.Name.Bomb_Shield4, pBombRoot, pShieldRoot4);
            pColPair.Attach(new RemoveBombObserver());
            pColPair.Attach(new RemoveBrickObserver());

            // Missile vs Shields
            pColPair = ColPairMan.Add(ColPair.Name.Missile_Shield1, pMissileGroup, pShieldRoot1);
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new RemoveBrickObserver());
            pColPair.Attach(new ShipReadyObserver(pShip));

            pColPair = ColPairMan.Add(ColPair.Name.Missile_Shield2, pMissileGroup, pShieldRoot2);
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new RemoveBrickObserver());
            pColPair.Attach(new ShipReadyObserver(pShip));

            pColPair = ColPairMan.Add(ColPair.Name.Missile_Shield3, pMissileGroup, pShieldRoot3);
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new RemoveBrickObserver());
            pColPair.Attach(new ShipReadyObserver(pShip));

            pColPair = ColPairMan.Add(ColPair.Name.Missile_Shield4, pMissileGroup, pShieldRoot4);
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new RemoveBrickObserver());
            pColPair.Attach(new ShipReadyObserver(pShip));

            // Alien Grid vs Shields
            pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_Shield1, pGrid, pShieldRoot1);
            pColPair.Attach(new RemoveBrickObserver());

            pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_Shield2, pGrid, pShieldRoot2);
            pColPair.Attach(new RemoveBrickObserver());

            pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_Shield3, pGrid, pShieldRoot3);
            pColPair.Attach(new RemoveBrickObserver());

            pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_Shield4, pGrid, pShieldRoot4);
            pColPair.Attach(new RemoveBrickObserver());

            // Missile vs Alien
            pColPair = ColPairMan.Add(ColPair.Name.Alien_Missile, pMissileGroup, pGrid);
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new RemoveAlienObserver());
            pColPair.Attach(new ShipReadyObserver(pShip));

            // Alien Grid vs WallLeft
            pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_WallLeft, pGrid, pWallLeft);
            pColPair.Attach(new AlienGridWallLeftObserver(pGridDelta));

            // Alien Grid vs WallRight
            pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_WallRight, pGrid, pWallRight);
            pColPair.Attach(new AlienGridWallRightObserver(pGridDelta));

            // Alien Grid vs WallBottom
            pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_WallBottom, pGrid, pWallBottom);
            pColPair.Attach(new AlienGridWallBottomObserver());

            // Ship vs Bomb
            pColPair = ColPairMan.Add(ColPair.Name.ShipBomb, pShipRoot, pBombRoot);
            pColPair.Attach(new BombObserver());

            //---------------------------------------------------------------------------------------------------------
            // Alien Animations
            //---------------------------------------------------------------------------------------------------------
            RedAlienAnimationCommand pRedAlienAnimation = new RedAlienAnimationCommand(GameSprite.Name.RedAlien);

            pRedAlienAnimation.Attach(Image.Name.RedAlien);
            pRedAlienAnimation.Attach(Image.Name.RedAlien2);
            TimerMan.Add(TimeEvent.Name.RedAlienAnimation, pRedAlienAnimation, 1.0f);

            BlueAlienAnimationCommand pBlueAlienAnimation = new BlueAlienAnimationCommand(GameSprite.Name.BlueAlien);

            pBlueAlienAnimation.Attach(Image.Name.BlueAlien);
            pBlueAlienAnimation.Attach(Image.Name.BlueAlien2);
            TimerMan.Add(TimeEvent.Name.BlueAlienAnimation, pBlueAlienAnimation, 1.0f);

            GreenAlienAnimationCommand pGreenAlienAnimation = new GreenAlienAnimationCommand(GameSprite.Name.GreenAlien);

            pGreenAlienAnimation.Attach(Image.Name.GreenAlien);
            pGreenAlienAnimation.Attach(Image.Name.GreenAlien2);
            TimerMan.Add(TimeEvent.Name.GreenAlienAnimation, pGreenAlienAnimation, 1.0f);

            //---------------------------------------------------------------------------------------------------------
            // Alien Bomb Spawns
            //---------------------------------------------------------------------------------------------------------
            BombSpawnEvent pBombSpawn = new BombSpawnEvent(pPlayer.nCurrLevel, pRandom);

            TimerMan.Add(TimeEvent.Name.BombSpawn, pBombSpawn, pRandom.Next(1, 10));

            //---------------------------------------------------------------------------------------------------------
            // Scene Play Sound
            //---------------------------------------------------------------------------------------------------------
            ScenePlaySoundCommand pScenePlaySound = new ScenePlaySoundCommand();

            pScenePlaySound.Attach(Sound.Name.Invader1);
            pScenePlaySound.Attach(Sound.Name.Invader2);
            pScenePlaySound.Attach(Sound.Name.Invader3);
            pScenePlaySound.Attach(Sound.Name.Invader4);
            TimerMan.Add(TimeEvent.Name.ScenePlaySound, pScenePlaySound, 1.5f);

            //---------------------------------------------------------------------------------------------------------
            // UFO
            //---------------------------------------------------------------------------------------------------------
            float           value = pRandom.Next(10, 60);
            SpawnUFOCommand pUFO  = new SpawnUFOCommand(pRandom, pWallLeft, pWallRight);

            TimerMan.Add(TimeEvent.Name.UFO, pUFO, value);

            //---------------------------------------------------------------------------------------------------------
            // Texts
            //---------------------------------------------------------------------------------------------------------
            Texture pTexture = TextureMan.Add(Texture.Name.Consolas36pt, "Consolas20pt.tga");

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

            Font pFont = FontMan.Add(Font.Name.Credits00, SpriteBatch.Name.Texts, "CREDIT 00", Glyph.Name.Consolas20pt, 700, 15);

            pFont.SetColor(1.0f, 1.0f, 1.0f);

            pFont = FontMan.Add(Font.Name.Score1, SpriteBatch.Name.Texts, "SCORE <1>", Glyph.Name.Consolas20pt, 150, 585);
            pFont.SetColor(1.0f, 1.0f, 1.0f);

            Player pPlayer1 = PlayerMan.GetPlayer(1);
            string pPlayer1Score;

            if (pPlayer1 != null)
            {
                pPlayer1Score = pPlayer1.nPoints.ToString();
            }
            else
            {
                pPlayer1Score = "0";
            }
            pFont = FontMan.Add(Font.Name.Score1Value, SpriteBatch.Name.Texts, pPlayer1Score, Glyph.Name.Consolas20pt, 150, 550);
            pFont.SetColor(1.0f, 1.0f, 1.0f);

            pFont = FontMan.Add(Font.Name.HighScore, SpriteBatch.Name.Texts, "HIGH SCORE", Glyph.Name.Consolas20pt, 400, 585);
            pFont.SetColor(1.0f, 1.0f, 1.0f);

            HighScore hS = new HighScore();

            pFont = FontMan.Add(Font.Name.HighScores, SpriteBatch.Name.Texts, hS.GetScore().ToString(), Glyph.Name.Consolas20pt, 400, 550);
            pFont.SetColor(1.0f, 1.0f, 1.0f);

            pFont = FontMan.Add(Font.Name.Score2, SpriteBatch.Name.Texts, "SCORE <2>", Glyph.Name.Consolas20pt, 650, 585);
            pFont.SetColor(1.0f, 1.0f, 1.0f);

            Player pPlayer2 = PlayerMan.GetPlayer(2);
            string pPlayer2Score;

            if (pPlayer2 != null)
            {
                pPlayer2Score = pPlayer2.nPoints.ToString();
            }
            else
            {
                pPlayer2Score = "0";
            }
            pFont = FontMan.Add(Font.Name.Score2Value, SpriteBatch.Name.Texts, pPlayer2Score, Glyph.Name.Consolas20pt, 650, 550);
            pFont.SetColor(1.0f, 1.0f, 1.0f);

            // Life Totals
            pFont = FontMan.Add(Font.Name.NumLives1, SpriteBatch.Name.Texts, pPlayer.nLives.ToString(), Glyph.Name.Consolas20pt, 15, 15);
            pFont.SetColor(1.0f, 1.0f, 1.0f);

            pShip = ShipMan.CreateInactiveShip(75, 15);
            pShip = ShipMan.CreateInactiveShip(150, 15);
        }