Beispiel #1
0
        // Should be called at some point after enter a new state
        public override void Initialize(GameManager pGameManager)
        {
            //Debug.WriteLine("Initializing the Attract Screen");
            //---------------------------------------------------------------------------------------------------------
            // Create Header Fonts
            //---------------------------------------------------------------------------------------------------------

            FontManager.Add(Font.Name.Play, SpriteBatch.Name.Texts, "PLAY", Glyph.Name.Consolas36pt, 400, 800);
            FontManager.Add(Font.Name.SpaceInvader, SpriteBatch.Name.Texts, "SPACE    INVADERS", Glyph.Name.Consolas36pt, 300, 700);
            FontManager.Add(Font.Name.ScoringTable, SpriteBatch.Name.Texts, "*SCORING ADVANCE TABLE*", Glyph.Name.Consolas36pt, 220, 600);
            FontManager.Add(Font.Name.ScoreMystery, SpriteBatch.Name.Texts, "= ? Mystery", Glyph.Name.Consolas36pt, 400, 550);
            FontManager.Add(Font.Name.ScoreSmInvader, SpriteBatch.Name.Texts, "= 30 POINTS", Glyph.Name.Consolas36pt, 400, 500);
            FontManager.Add(Font.Name.ScoreMedInvader, SpriteBatch.Name.Texts, "= 20 POINTS", Glyph.Name.Consolas36pt, 400, 450);
            FontManager.Add(Font.Name.ScoreLgInvader, SpriteBatch.Name.Texts, "= 10 POINTS", Glyph.Name.Consolas36pt, 400, 400);
            FontManager.Add(Font.Name.PressSpace, SpriteBatch.Name.Texts, "<PRESS SPACE TO CONTINUE>", Glyph.Name.Consolas36pt, 200, 200);

            InvaderFactory rootLevelIF = new InvaderFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes);
            UFO            pUFO        = (UFO)rootLevelIF.ActiveCreate(GameObject.Type.UFO, 350, 550);

            pUFO.speedX = 0;
            rootLevelIF.ActiveCreate(GameObject.Type.SmallInvader, 350, 500);
            rootLevelIF.ActiveCreate(GameObject.Type.MediumInvader, 350, 450);
            rootLevelIF.ActiveCreate(GameObject.Type.LargeInvader, 350, 400);

            InputSubject pInputSubject = InputManager.GetSpaceSubject();

            pInputSubject.Attach(new AdvanceGameStateObserver());
        }
Beispiel #2
0
        // Should be called at some point before leaving state
        public override void CleanUp(GameManager pGameManager)
        {
            //Debug.WriteLine("Cleaning up Attract Screen and Preparing to leave");

            // Clear text before leaving select screen
            FontManager.Remove(FontManager.Find(Font.Name.Play));
            FontManager.Remove(FontManager.Find(Font.Name.SpaceInvader));
            FontManager.Remove(FontManager.Find(Font.Name.ScoringTable));
            FontManager.Remove(FontManager.Find(Font.Name.ScoreMystery));
            FontManager.Remove(FontManager.Find(Font.Name.ScoreSmInvader));
            FontManager.Remove(FontManager.Find(Font.Name.ScoreMedInvader));
            FontManager.Remove(FontManager.Find(Font.Name.ScoreLgInvader));
            FontManager.Remove(FontManager.Find(Font.Name.PressSpace));

            GameObject pGameObj = GameObjectManager.Find(GameObject.Name.UFO);

            pGameObj.Remove();
            pGameObj = GameObjectManager.Find(GameObject.Name.SmallInvader);
            pGameObj.Remove();
            pGameObj = GameObjectManager.Find(GameObject.Name.MediumInvader);
            pGameObj.Remove();
            pGameObj = GameObjectManager.Find(GameObject.Name.LargeInvader);
            pGameObj.Remove();

            InputSubject pInputSubject = InputManager.GetSpaceSubject();

            pInputSubject.PurgeAll();

            Handle(pGameManager);
        }
Beispiel #3
0
        // Should be called at some point after enter a new state
        public override void Initialize(GameManager pGameManager)
        {
            //Debug.WriteLine("Initializing the Select Screen");
            //---------------------------------------------------------------------------------------------------------
            // Create Header Fonts
            //---------------------------------------------------------------------------------------------------------

            FontManager.Add(Font.Name.InsertCoin, SpriteBatch.Name.Texts, "INSERT COIN", Glyph.Name.Consolas36pt, 350, 800);
            FontManager.Add(Font.Name.OneOrTwo, SpriteBatch.Name.Texts, "<1 OR 2 PLAYERS>", Glyph.Name.Consolas36pt, 300, 700);
            FontManager.Add(Font.Name.Select1P, SpriteBatch.Name.Texts, "*1 PLAYER    PRESS 1", Glyph.Name.Consolas36pt, 260, 600);
            FontManager.Add(Font.Name.Select2P, SpriteBatch.Name.Texts, "*2 PLAYERS   PRESS 2", Glyph.Name.Consolas36pt, 260, 550);

            InputSubject pInputSubject = InputManager.GetSpaceSubject();

            pInputSubject.Attach(new SetGameModeObserver(GameManager.Mode.OnePlayerMode));
            pInputSubject.Attach(new AdvanceGameStateObserver());

            pInputSubject = InputManager.GetOneSubject();
            pInputSubject.Attach(new SetGameModeObserver(GameManager.Mode.OnePlayerMode));
            pInputSubject.Attach(new AdvanceGameStateObserver());

            pInputSubject = InputManager.GetTwoSubject();
            pInputSubject.Attach(new SetGameModeObserver(GameManager.Mode.TwoPlayerMode));
            pInputSubject.Attach(new AdvanceGameStateObserver());
        }
Beispiel #4
0
        public override void Initialize()
        {
            this.poSpriteBatchManager = new SpriteBatchManager(3, 1);
            SpriteBatchManager.SetActive(this.poSpriteBatchManager);

            SpriteBatch pSB_Texts = SpriteBatchManager.Add(SpriteBatch.Name.Texts, 4);

            //---------------------------------------------------------------------------------------------------------
            // Create Texts
            //---------------------------------------------------------------------------------------------------------
            this.poFontManager = new FontManager(3, 1);
            FontManager.SetActive(this.poFontManager);

            FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "GAME  OVER", 300f, SpaceInvaders.ScreenHeight - 350f, 15f, 25f);
            FontManager.Add(Font.Name.Header, SpriteBatch.Name.Texts, "SCORE<1>       HI-SCORE       SCORE<2>", 20f, SpaceInvaders.ScreenHeight - 20f, 15f, 25f);
            FontManager.Add(Font.Name.Player1Score, SpriteBatch.Name.Texts, "0000", 65f, SpaceInvaders.ScreenHeight - 70f, 15f, 25f);
            FontManager.Add(Font.Name.Player2Score, SpriteBatch.Name.Texts, "0000", SpaceInvaders.ScreenWidth - 156f, SpaceInvaders.ScreenHeight - 70f, 15f, 25f);
            FontManager.Add(Font.Name.HiScore, SpriteBatch.Name.Texts, "0000", 380f, SpaceInvaders.ScreenHeight - 70f, 15f, 25f);

            //---------------------------------------------------------------------------------------------------------
            // Input
            //---------------------------------------------------------------------------------------------------------
            this.poInputManager = new InputManager();
            InputManager.SetActive(this.poInputManager);
            InputSubject pInputSubject = InputManager.GetSpaceSubject();

            pInputSubject.Attach(new SelectPlayObserver());
        }
Beispiel #5
0
        // Should be called at some point before leaving state
        public override void CleanUp(GameManager pGameManager)
        {
            GameManager.PushHighScoreToFont();

            ShipManager.Purge();

            TimerManager.PurgeAllNodes();
            GameObjectManager.PurgeAllNodes();

            SpriteBatch pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes);

            pSBatch.GetSBNodeManager().PurgeAllNodes();
            pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Sprites);
            pSBatch.GetSBNodeManager().PurgeAllNodes();

            ColPairManager.PurgeAllNodes();

            DelayedObjectManager.PurgeAll();

            InputSubject pInputSubject = InputManager.GetArrowLeftSubject();

            pInputSubject.PurgeAll();

            pInputSubject = InputManager.GetArrowRightSubject();
            pInputSubject.PurgeAll();

            pInputSubject = InputManager.GetSpaceSubject();
            pInputSubject.PurgeAll();


            Handle(pGameManager);
        }
Beispiel #6
0
        // Should be called at some point after enter a new state
        public override void Initialize(GameManager pGameManager)
        {
            //Debug.WriteLine("Initializing the GamePlay State in {0}", pGameManager.gameMode);

            Font pCredits      = FontManager.Find(Font.Name.Credits);
            Font pScoreHeader1 = FontManager.Find(Font.Name.ScoreHeader1);
            Font pScoreHeader2 = FontManager.Find(Font.Name.ScoreHeader2);

            pScoreHeader1.UpdateMessage("*SCORE<1>*");
            pScoreHeader2.UpdateMessage(" SCORE<2> ");
            LivesManager.DisplayLives(3);

            //---------------------------------------------------------------------------------------------------------
            // Create the player ship and missile
            //---------------------------------------------------------------------------------------------------------
            ShipManager.Create();

            pGameManager.SetActivePlayer(PlayerArtifact.Name.PlayerOne);
            pGameManager.pActiveGameModeStrategy.InitializeLevel(pGameManager);
            pGameManager.poPlayer1.RestoreManagerStates(pGameManager.pGame.GetTime());

            //---------------------------------------------------------------------------------------------------------
            // Add Keyboard Input Observers
            //---------------------------------------------------------------------------------------------------------
            InputSubject pInputSubject = InputManager.GetArrowLeftSubject();

            pInputSubject.Attach(new MoveLeftObserver());

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

            pInputSubject = InputManager.GetSpaceSubject();
            pInputSubject.Attach(new ShootObserver());
        }
        public override void Initialize()
        {
            this.poSpriteBatchMan = new SpriteBatchMan(3, 1);
            SpriteBatchMan.SetActive(this.poSpriteBatchMan);

            this.poFontMan = new FontMan();
            FontMan.SetActive(this.poFontMan);

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

            SpriteBatch pSB_Texts = SpriteBatchMan.Add(SpriteBatch.Name.Texts, 100, true);

            HighScore hS = new HighScore();

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

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

            Font pFont = FontMan.Add(Font.Name.HighScore, SpriteBatch.Name.Texts, "High Score", Glyph.Name.Consolas36pt, 100, 500);

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

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

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Back to Menu", Glyph.Name.Consolas20pt, 100, 100);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            InputSubject pInputSubject = InputMan.GetCursorSubject();

            pInputSubject.Attach(new HighlightHoverTextObserver(pFont));
            pInputSubject = InputMan.GetMouseLeftKeySubject();
            pInputSubject.Attach(new MenuChoiceObserver(pFont));
        }
Beispiel #8
0
 private InputManager()
 {
     this.SubjectArrowLeft  = new InputSubject();
     this.SubjectArrowRight = new InputSubject();
     this.SubjectSpacebar   = new InputSubject();
     this.SubjectOne        = new InputSubject();
     this.SubjectTwo        = new InputSubject();
     this.SpaceKeyPrev      = false;
 }
Beispiel #9
0
        private InputManager()
        {
            this.pSubjectKey_ArrowLeft  = new InputSubject();
            this.pSubjectKey_ArrowRight = new InputSubject();
            this.pSubjectKey_Space      = new InputSubject();

            this.pSubjectKey_C = new InputSubject();
            this.pSubjectKey_T = new InputSubject();


            this.privKeyPrev_Space = false;
        }
        public InputManager()
        {
            this.pSubjectArrowLeft  = new InputSubject();
            this.pSubjectArrowRight = new InputSubject();
            this.pSubjectSpace      = new InputSubject();
            this.pSubjectCKey       = new InputSubject();
            this.pSubject1Key       = new InputSubject();
            this.pSubject2Key       = new InputSubject();

            this.pSpaceKeyPrev = false;
            this.pCKeyPrev     = false;
        }
Beispiel #11
0
        private InputManager()
        {
            this.pSubjectArrowLeft  = new InputSubject();
            this.pSubjectArrowRight = new InputSubject();
            this.pSubjectSpace      = new InputSubject();
            this.pSubjectKeyN       = new InputSubject();
            this.pSubjectKey1       = new InputSubject();
            this.pSubjectKey2       = new InputSubject();

            this.privSpaceKeyPrev = false;
            this.privNKeyPrev     = false;
            this.privKey1Prev     = false;
            this.privKey2Prev     = false;
        }
        private InputManager()
        {
            this.pSubjectArrowLeft  = new InputSubject();
            this.pSubjectArrowRight = new InputSubject();

            this.privSpaceKeyPrev = false;
            this.pSubjectSpace    = new InputSubject();

            this.priv_B_KeyPrev = false;
            this.pSubjectBkey   = new InputSubject();

            this.priv_C_KeyPrev = false;
            this.pSubjectCkey   = new InputSubject();
        }
        //----------------------------------------------------------------------------------
        // Constructor
        //----------------------------------------------------------------------------------
        public InputManager(bool b = false)
        {
            this.pSubjectArrowLeft  = new InputSubject();
            this.pSubjectArrowRight = new InputSubject();

            this.pSubjectSpace    = new InputSubject();
            this.privSpaceKeyPrev = b;

            this.pSubjectBkey   = new InputSubject();
            this.priv_B_KeyPrev = b;

            this.priv_C_KeyPrev = false;
            this.pSubjectCkey   = new InputSubject();
        }
Beispiel #14
0
        private InputManager()
        {
            this.pSubjectArrowLeft  = new InputSubject();
            this.pSubjectArrowRight = new InputSubject();
            this.pSubjectSpace      = new InputSubject();
            this.pSubjectOne        = new InputSubject();
            this.pSubjectTwo        = new InputSubject();
            this.pSubjectB          = new InputSubject();

            this.privSpaceKeyPrev = false;
            this.priv1KeyPrev     = false;
            this.priv2KeyPrev     = false;
            this.privBKeyPrev     = false;
        }
Beispiel #15
0
        // Should be called at some point before leaving state
        public override void CleanUp(GameManager pGameManager)
        {
            pGameManager.poPlayer1.Reset();
            pGameManager.poPlayer2.Reset();
            GameManager.PushPlayerScoresToFonts();

            FontManager.Remove(FontManager.Find(Font.Name.PressSpace));
            FontManager.Remove(FontManager.Find(Font.Name.GameOver));

            InputSubject pInputSubject = InputManager.GetSpaceSubject();

            pInputSubject.PurgeAll();

            Handle(pGameManager);
        }
Beispiel #16
0
        private InputMan()
        {
            this.pSubjectArrowLeft  = new InputSubject();
            this.pSubjectArrowRight = new InputSubject();
            this.pSubjectSpace      = new InputSubject();
            this.pSubjectT          = new InputSubject();
            this.pSubjectR          = new InputSubject();
            this.pSubject1          = new InputSubject();
            this.pSubject2          = new InputSubject();
            this.pSubjectSlash      = new InputSubject();

            this.privSpaceKeyPrev = false;
            this.privTKeyPrev     = false;
            this.privRKeyPrev     = false;
            this.priv1KeyPrev     = false;
            this.priv2KeyPrev     = false;
            this.privSLashKeyPrev = false;
        }
Beispiel #17
0
        public InputManager()
        {
            leftKeyPress  = new InputSubject();
            rightKeyPress = new InputSubject();
            spaceKeyPress = new InputSubject();
            zeroKeyPress  = new InputSubject();
            nineKeyPress  = new InputSubject();
            enterKeyPress = new InputSubject();
            // attachObservers();

            leftKeyPress.attachObserver(new LeftKeyObserver());
            rightKeyPress.attachObserver(new RightKeyObserver());
            spaceKeyPress.attachObserver(new SpaceKeyObserver());
            zeroKeyPress.attachObserver(new ZeroKeyPressObserver());
            nineKeyPress.attachObserver(new NinePressObserver());
            enterKeyPress.attachObserver(new EnterKeyObserver());
            inputInstance = this;
            spacePressed  = false;
        }
Beispiel #18
0
        private InputManager()
        {
            this.pSubjectArrowLeft  = new InputSubject();
            this.pSubjectArrowRight = new InputSubject();
            this.pSubjectSpaceBar   = new InputSubject();

            this.pSubject_C = new InputSubject();
            this.pSubject_X = new InputSubject();

            this.pSubject_1 = new InputSubject();
            this.pSubject_2 = new InputSubject();

            this.privSpaceKeyPrev = false;

            this.priv1keyPrev = false;
            this.priv2keyPrev = false;

            this.privCkeyPrev = false;
            this.privSkeyPrev = false;
        }
Beispiel #19
0
        // Should be called at some point after enter a new state
        public override void Initialize(GameManager pGameManager)
        {
            FontManager.Add(Font.Name.GameOver, SpriteBatch.Name.Texts, "GAME  OVER", Glyph.Name.Consolas36pt, 350, 800);
            FontManager.Add(Font.Name.PressSpace, SpriteBatch.Name.Texts, "<PRESS SPACE TO CONTINUE>", Glyph.Name.Consolas36pt, 200, 200);

            Font pCredits = FontManager.Find(Font.Name.Credits);

            pCredits.UpdateMessage("CREDITS  00");

            Font pScoreHeader1 = FontManager.Find(Font.Name.ScoreHeader1);
            Font pScoreHeader2 = FontManager.Find(Font.Name.ScoreHeader2);

            pScoreHeader1.UpdateMessage(" SCORE<1> ");
            pScoreHeader2.UpdateMessage(" SCORE<2> ");


            InputSubject pInputSubject = InputManager.GetSpaceSubject();

            pInputSubject.Attach(new AdvanceGameStateObserver());
        }
Beispiel #20
0
        // Should be called at some point before leaving state
        public override void CleanUp(GameManager pGameManager)
        {
            //Debug.WriteLine("Cleaning up Select Screen and Preparing to leave");
            // Clear text before leaving select screen
            FontManager.Remove(FontManager.Find(Font.Name.InsertCoin));
            FontManager.Remove(FontManager.Find(Font.Name.OneOrTwo));
            FontManager.Remove(FontManager.Find(Font.Name.Select1P));
            FontManager.Remove(FontManager.Find(Font.Name.Select2P));

            InputSubject pInputSubject = InputManager.GetSpaceSubject();

            pInputSubject.PurgeAll();

            pInputSubject = InputManager.GetOneSubject();
            pInputSubject.PurgeAll();

            pInputSubject = InputManager.GetTwoSubject();
            pInputSubject.PurgeAll();

            Handle(pGameManager);
        }
Beispiel #21
0
        public override void LoadContent()
        {
            //---------------------------------------------------------------------------------------------------------
            // Create all the managers!
            //---------------------------------------------------------------------------------------------------------

            TextureManager.Create();
            ImageManager.Create();
            SpriteManager.Create();
            SoundManager.Create();
            BoxSpriteManager.Create();
            SpriteBatchManager.Create();
            TimerManager.Create();
            ProxySpriteManager.Create();
            ProxyBoxSpriteManager.Create();
            GameObjectManager.Create();
            ColPairManager.Create();
            GlyphManager.Create();
            FontManager.Create();

            //---------------------------------------------------------------------------------------------------------
            // Add the Sound Assets
            //---------------------------------------------------------------------------------------------------------
            SoundManager.Add(Sound.Name.InvaderMarch1, 0.05f);
            SoundManager.Add(Sound.Name.InvaderMarch2, 0.05f);
            SoundManager.Add(Sound.Name.InvaderMarch3, 0.05f);
            SoundManager.Add(Sound.Name.InvaderMarch4, 0.05f);

            SoundManager.Add(Sound.Name.Invaderkilled, 0.025f);

            SoundManager.Add(Sound.Name.Shoot, 0.025f);

            SoundManager.Add(Sound.Name.UFOHighPitch);
            SoundManager.Add(Sound.Name.UFOLowPitch, 0.01f);

            SoundManager.Add(Sound.Name.Uninitialized);

            //---------------------------------------------------------------------------------------------------------
            // Add the Texture and all the Images
            //---------------------------------------------------------------------------------------------------------
            TextureManager.Add(Texture.Name.Invader);
            Texture pTexture = TextureManager.Add(Texture.Name.Consolas36pt);

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

            ImageManager.Add(Image.Name.ShieldBrick);
            ImageManager.Add(Image.Name.Ship);
            ImageManager.Add(Image.Name.Missile);
            ImageManager.Add(Image.Name.SmallInvader1);
            ImageManager.Add(Image.Name.SmallInvader2);
            ImageManager.Add(Image.Name.MediumInvader1);
            ImageManager.Add(Image.Name.MediumInvader2);
            ImageManager.Add(Image.Name.LargeInvader1);
            ImageManager.Add(Image.Name.LargeInvader2);
            ImageManager.Add(Image.Name.UFO);

            ImageManager.Add(Image.Name.BombPlain);

            ImageManager.Add(Image.Name.BombZigZag1);
            ImageManager.Add(Image.Name.BombZigZag2);
            ImageManager.Add(Image.Name.BombZigZag3);
            ImageManager.Add(Image.Name.BombZigZag4);

            ImageManager.Add(Image.Name.BombDagger1);
            ImageManager.Add(Image.Name.BombDagger2);
            ImageManager.Add(Image.Name.BombDagger3);
            ImageManager.Add(Image.Name.BombDagger4);

            ImageManager.Add(Image.Name.BombRolling1);
            ImageManager.Add(Image.Name.BombRolling2);
            ImageManager.Add(Image.Name.BombRolling3);

            ImageManager.Add(Image.Name.InvaderDeath1);
            ImageManager.Add(Image.Name.InvaderDeath2);
            ImageManager.Add(Image.Name.UFODeath);
            ImageManager.Add(Image.Name.ShipDeath1);
            ImageManager.Add(Image.Name.ShipDeath2);
            ImageManager.Add(Image.Name.BombDeath);

            //---------------------------------------------------------------------------------------------------------
            // Add all the Sprites and BoxSprites (x,y pos not needed since its determined by factory upon object creation)
            //---------------------------------------------------------------------------------------------------------
            SpriteManager.Add(Sprite.Name.ShieldBrick, Image.Name.ShieldBrick, 0, 0, Constants.shieldBrickWidth, Constants.shieldBrickHeight, new Azul.Color(0.0f, 0.5f, 0.0f));
            SpriteManager.Add(Sprite.Name.Ship, Image.Name.Ship, 0, 0, Constants.shipWidth, Constants.shipHeight);
            SpriteManager.Add(Sprite.Name.Missile, Image.Name.Missile, 0, 0, Constants.missileWidth, Constants.missileHeight);
            SpriteManager.Add(Sprite.Name.SmallInvader, Image.Name.SmallInvader1, 0, 0, Constants.smallInvaderWidth, Constants.smallInvaderHeight, new Azul.Color(0.5f, 0.0f, 0.5f));
            SpriteManager.Add(Sprite.Name.MediumInvader, Image.Name.MediumInvader1, 0, 0, Constants.mediumInvaderWidth, Constants.mediumInvaderHeight, new Azul.Color(0.3f, 0.0f, 0.75f));
            SpriteManager.Add(Sprite.Name.LargeInvader, Image.Name.LargeInvader1, 0, 0, Constants.largeInvaderWidth, Constants.largeInvaderHeight, new Azul.Color(0.25f, 0.0f, 1.0f));
            SpriteManager.Add(Sprite.Name.UFO, Image.Name.UFO, 0, 0, Constants.UFOWidth, Constants.UFOHeight, new Azul.Color(0.75f, 0.2f, 0.2f));

            SpriteManager.Add(Sprite.Name.BombPlain, Image.Name.BombPlain, 0, 0, Constants.bombPlainWidth, Constants.bombPlainHeight);
            SpriteManager.Add(Sprite.Name.BombZigZag, Image.Name.BombZigZag1, 0, 0, Constants.bombZigZagWidth, Constants.bombZigZagHeight);
            SpriteManager.Add(Sprite.Name.BombDagger, Image.Name.BombDagger1, 0, 0, Constants.bombDaggerWidth, Constants.bombDaggerHeight);
            SpriteManager.Add(Sprite.Name.BombRolling, Image.Name.BombRolling1, 0, 0, Constants.bombRollingWidth1, Constants.bombRollingHeight1);

            SpriteManager.Add(Sprite.Name.InvaderDeath, Image.Name.InvaderDeath1, -50, -50, Constants.largeInvaderWidth, Constants.largeInvaderHeight, new Azul.Color(0.5f, 0.5f, 0.1f));
            SpriteManager.Add(Sprite.Name.BombDeath, Image.Name.BombDeath, -50, -50, Constants.bombDaggerWidth, Constants.bombDaggerHeight, new Azul.Color(0.75f, 0.1f, 0.1f));

            // Add BoxSprites (size of box gets determined by GameObject's ColObject)
            BoxSpriteManager.Add(BoxSprite.Name.ShipBox, new Azul.Color(0.25f, 1.0f, 0.5f));
            BoxSpriteManager.Add(BoxSprite.Name.MissileBox, new Azul.Color(0.25f, 1.0f, 0.5f));
            BoxSpriteManager.Add(BoxSprite.Name.SmallInvaderBox, new Azul.Color(1.0f, 0.0f, 0.0f));
            BoxSpriteManager.Add(BoxSprite.Name.MediumInvaderBox, new Azul.Color(1.0f, 0.0f, 0.0f));
            BoxSpriteManager.Add(BoxSprite.Name.LargeInvaderBox, new Azul.Color(1.0f, 0.0f, 0.0f));
            BoxSpriteManager.Add(BoxSprite.Name.InvaderColumnBox, new Azul.Color(0.0f, 1.0f, 0.0f));
            BoxSpriteManager.Add(BoxSprite.Name.InvaderGridBox, new Azul.Color(0.25f, 0.25f, 1.0f));
            BoxSpriteManager.Add(BoxSprite.Name.UFOBox, new Azul.Color(1.0f, 0.0f, 1.0f));
            BoxSpriteManager.Add(BoxSprite.Name.WallBox, new Azul.Color(1.0f, 1.0f, 0.0f));
            BoxSpriteManager.Add(BoxSprite.Name.GameSpaceBox, new Azul.Color(1.0f, 1.0f, 1.0f));
            BoxSpriteManager.Add(BoxSprite.Name.ShieldBrickBox, new Azul.Color(0.0f, 0.0f, 0.0f));
            BoxSpriteManager.Add(BoxSprite.Name.ShieldColumnBox, new Azul.Color(0.25f, 0.25f, 0.75f));
            BoxSpriteManager.Add(BoxSprite.Name.ShieldBox, new Azul.Color(0.25f, 0.75f, 0.25f));
            BoxSpriteManager.Add(BoxSprite.Name.ShieldZoneBox, new Azul.Color(0.25f, 0.25f, 1.0f));
            BoxSpriteManager.Add(BoxSprite.Name.BombBox, new Azul.Color(0.25f, 0.25f, 1.0f));

            // Create batches for group processing and rendering
            SpriteBatchManager.Add(SpriteBatch.Name.Texts);
            SpriteBatchManager.Add(SpriteBatch.Name.Boxes);
            SpriteBatchManager.Add(SpriteBatch.Name.Sprites);
            SpriteBatch pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes);

            pSBatch.enabled = false;

            pSBatch = SpriteBatchManager.Add(SpriteBatch.Name.Deaths);
            pSBatch.Attach(SpriteManager.Find(Sprite.Name.BombDeath));
            pSBatch.Attach(SpriteManager.Find(Sprite.Name.InvaderDeath));

            //---------------------------------------------------------------------------------------------------------
            // Create Header Fonts
            //---------------------------------------------------------------------------------------------------------

            Font pScoreHeader1   = FontManager.Add(Font.Name.ScoreHeader1, SpriteBatch.Name.Texts, " SCORE<1> ", Glyph.Name.Consolas36pt, 100, 1000);
            Font pScoreHeader2   = FontManager.Add(Font.Name.ScoreHeader2, SpriteBatch.Name.Texts, " SCORE<2> ", Glyph.Name.Consolas36pt, 650, 1000);
            Font HighScoreHeader = FontManager.Add(Font.Name.HighScoreHeader, SpriteBatch.Name.Texts, "HI-SCORE", Glyph.Name.Consolas36pt, 400, 1000);

            FontManager.Add(Font.Name.Score1, SpriteBatch.Name.Texts, "0000", Glyph.Name.Consolas36pt, pScoreHeader1.pFontSprite.x + 30, 960);
            FontManager.Add(Font.Name.Score2, SpriteBatch.Name.Texts, "0000", Glyph.Name.Consolas36pt, pScoreHeader2.pFontSprite.x + 30, 960);
            FontManager.Add(Font.Name.HighScore, SpriteBatch.Name.Texts, "0000", Glyph.Name.Consolas36pt, HighScoreHeader.pFontSprite.x + 30, 960);

            Font pLives   = FontManager.Add(Font.Name.Lives, SpriteBatch.Name.Texts, "0", Glyph.Name.Consolas36pt, 50, 100);
            Font pCredits = FontManager.Add(Font.Name.Credits, SpriteBatch.Name.Texts, "CREDITS  00", Glyph.Name.Consolas36pt, 650, 100);

            GameManager.Create(this);
            GameManager.SetGameState(GameManager.State.AttractScreen);
            GameManager.Initialize();

            // Setup toggle boxes input observer
            InputSubject pInputSubject = InputManager.GetBSubject();

            pInputSubject.Attach(new ToggleSpriteBoxObserver());
        }
Beispiel #22
0
        public override void Initialize()
        {
            this.poSpriteBatchMan = new SpriteBatchMan(3, 1);
            SpriteBatchMan.SetActive(this.poSpriteBatchMan);

            this.poFontMan = new FontMan();
            FontMan.SetActive(this.poFontMan);

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

            SpriteBatch pSB_Texts = SpriteBatchMan.Add(SpriteBatch.Name.Texts, 100, true);

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

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

            Font pFont = FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "Instructions", Glyph.Name.Consolas36pt, 100, 500);

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

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Player One", Glyph.Name.Consolas20pt, 100, 450);
            pFont.SetColor(0.80f, 0.80f, 0.80f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Move Left: ", Glyph.Name.Consolas20pt, 100, 400);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Left Arrow Key", Glyph.Name.Consolas20pt, 225, 400);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Move Right: ", Glyph.Name.Consolas20pt, 100, 350);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Right Arrow Key", Glyph.Name.Consolas20pt, 225, 350);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Shoot: ", Glyph.Name.Consolas20pt, 100, 300);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Spacebar", Glyph.Name.Consolas20pt, 175, 300);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Player Two", Glyph.Name.Consolas20pt, 500, 450);
            pFont.SetColor(0.80f, 0.80f, 0.80f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Move Left: ", Glyph.Name.Consolas20pt, 500, 400);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "A", Glyph.Name.Consolas20pt, 625, 400);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Move Right: ", Glyph.Name.Consolas20pt, 500, 350);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "D", Glyph.Name.Consolas20pt, 625, 350);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Shoot: ", Glyph.Name.Consolas20pt, 500, 300);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "S", Glyph.Name.Consolas20pt, 625, 300);
            pFont.SetColor(0.60f, 0.60f, 0.60f);


            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Back to Menu", Glyph.Name.Consolas20pt, 100, 100);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            InputSubject pInputSubject = InputMan.GetCursorSubject();

            pInputSubject.Attach(new HighlightHoverTextObserver(pFont));
            pInputSubject = InputMan.GetMouseLeftKeySubject();
            pInputSubject.Attach(new MenuChoiceObserver(pFont));
        }
Beispiel #23
0
        public override void Initialize()
        {
            ImageMan.Add(Image.Name.BlueAlien, Texture.Name.Aliens, new Azul.Rect(341, 337, 65, 64));
            ImageMan.Add(Image.Name.GreenAlien, Texture.Name.Aliens, new Azul.Rect(27, 337, 79, 64));
            ImageMan.Add(Image.Name.RedAlien, Texture.Name.Aliens, new Azul.Rect(647, 200, 72, 65));

            ImageMan.Add(Image.Name.UFO, Texture.Name.Aliens, new Azul.Rect(120, 489, 98, 49));
            ImageMan.Add(Image.Name.Ship, Texture.Name.Birds, new Azul.Rect(10, 93, 30, 18));

            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));

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

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

            this.poFontMan = new FontMan();
            FontMan.SetActive(this.poFontMan);

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

            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_Boxes   = SpriteBatchMan.Add(SpriteBatch.Name.Boxes, 100, false);

            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.Ship, Image.Name.Ship, 500, 100, 60, 20);

            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);

            AlienFactory aF       = new AlienFactory(SpriteBatch.Name.Aliens, SpriteBatch.Name.Boxes);
            Texture      pTexture = TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");

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

            Font pFont = FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "Aliens", Glyph.Name.Consolas36pt, 100, 500);

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

            RedAlien redAlien = (RedAlien)aF.Create(GameObject.Name.RedAlien, AlienCategory.Type.Red, 300.0f, 200.0f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, redAlien.GetPoints().ToString(), Glyph.Name.Consolas20pt, 375.0f, 200.0f);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            GreenAlien greenAlien = (GreenAlien)aF.Create(GameObject.Name.GreenAlien, AlienCategory.Type.Green, 300.0f, 275.0f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, greenAlien.GetPoints().ToString(), Glyph.Name.Consolas20pt, 375.0f, 275.0f);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            BlueAlien blueAlien = (BlueAlien)aF.Create(GameObject.Name.BlueAlien, AlienCategory.Type.Blue, 300.0f, 350.0f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, blueAlien.GetPoints().ToString(), Glyph.Name.Consolas20pt, 375.0f, 350.0f);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            UFO ufo = new UFO(GameObject.Name.UFO, GameSprite.Name.UFO, 300.0f, 425.0f);

            ufo.ActivateGameSprite(pSB_Aliens);
            GameObjectMan.Attach(ufo);
            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "?", Glyph.Name.Consolas20pt, 375.0f, 425.0f);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Back to Menu", Glyph.Name.Consolas20pt, 100, 100);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            InputSubject pInputSubject = InputMan.GetCursorSubject();

            pInputSubject.Attach(new HighlightHoverTextObserver(pFont));
            pInputSubject = InputMan.GetMouseLeftKeySubject();
            pInputSubject.Attach(new MenuChoiceObserver(pFont));
        }
 protected abstract void derivedUpdate(InputSubject pInputSubject);
        protected override void derivedUpdate(InputSubject pInputSubject)
        {
            SpriteBatch pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes);

            pSBatch.enabled = !pSBatch.enabled;
        }
Beispiel #26
0
        protected override void derivedUpdate(InputSubject pInputSubject)
        {
            Ship pShip = ShipManager.GetShip();

            pShip.ShootMissile();
        }
Beispiel #27
0
        public override void Initialize()
        {
            //---------------------------------------------------------------------------------------------------------
            // Create SpriteBatch
            //---------------------------------------------------------------------------------------------------------
            this.poSpriteBatchManager = new SpriteBatchManager(3, 1);
            SpriteBatchManager.SetActive(this.poSpriteBatchManager);

            SpriteBatch pSB_Texts  = SpriteBatchManager.Add(SpriteBatch.Name.Texts, 4);
            SpriteBatch pSB_Aliens = SpriteBatchManager.Add(SpriteBatch.Name.Aliens, 1);

            //---------------------------------------------------------------------------------------------------------
            // Game Objects
            //---------------------------------------------------------------------------------------------------------

            OrangeSaucer pSaucer = new OrangeSaucer(GameObject.Name.Null_Object, GameSprite.Name.OrangeSaucer, 325, SpaceInvaders.ScreenHeight - 575f);

            pSaucer.ActivateGameSprite(pSB_Aliens);

            GreenSquid pSquid = new GreenSquid(GameObject.Name.Null_Object, GameSprite.Name.GreenSquid, 325, SpaceInvaders.ScreenHeight - 650f);

            pSquid.ActivateGameSprite(pSB_Aliens);

            BlueCrab pCrab = new BlueCrab(GameObject.Name.Null_Object, GameSprite.Name.BlueCrab, 325, SpaceInvaders.ScreenHeight - 725f);

            pCrab.ActivateGameSprite(pSB_Aliens);

            PurpleOctopus pOcto = new PurpleOctopus(GameObject.Name.Null_Object, GameSprite.Name.PurpleOctopus, 325, SpaceInvaders.ScreenHeight - 800f);

            pOcto.ActivateGameSprite(pSB_Aliens);



            //---------------------------------------------------------------------------------------------------------
            // Create Texts
            //---------------------------------------------------------------------------------------------------------
            this.poFontManager = new FontManager(3, 1);
            FontManager.SetActive(this.poFontManager);

            FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "PLAY", 380f, SpaceInvaders.ScreenHeight - 250f, 15f, 25f);

            FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "SPACE   INVADERS", 255f, SpaceInvaders.ScreenHeight - 350f, 15f, 25f);

            FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "*SCORE ADVANCE TABLE*", 200f, SpaceInvaders.ScreenHeight - 500f, 15f, 25f);

            FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "=? MYSTERY", 350f, SpaceInvaders.ScreenHeight - 575f, 15f, 25f);
            FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "=30 POINTS", 350f, SpaceInvaders.ScreenHeight - 650f, 15f, 25f);
            FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "=20 POINTS", 350f, SpaceInvaders.ScreenHeight - 725f, 15f, 25f);
            FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "=10 POINTS", 350f, SpaceInvaders.ScreenHeight - 800f, 15f, 25f);

            FontManager.Add(Font.Name.Header, SpriteBatch.Name.Texts, "SCORE<1>       HI-SCORE       SCORE<2>", 20f, SpaceInvaders.ScreenHeight - 20f, 15f, 25f);
            FontManager.Add(Font.Name.HiScore, SpriteBatch.Name.Texts, "0000          0000            0000", 65f, SpaceInvaders.ScreenHeight - 70f, 15f, 25f);


            //---------------------------------------------------------------------------------------------------------
            // Input
            //---------------------------------------------------------------------------------------------------------
            this.poInputManager = new InputManager();
            InputManager.SetActive(this.poInputManager);
            InputSubject pInputSubject = InputManager.GetSpaceSubject();

            pInputSubject.Attach(new SelectPlayObserver());
        }
        protected override void derivedUpdate(InputSubject pInputSubject)
        {
            Ship pShip = ShipManager.GetShip();

            pShip.MoveRight();
        }
        protected override void derivedUpdate(InputSubject pInputSubject)
        {
            AdvanceGameStateObserver pObserver = new AdvanceGameStateObserver();

            DelayedObjectManager.Attach(pObserver);
        }
Beispiel #30
0
 protected override void derivedUpdate(InputSubject pInputSubject)
 {
     GameManager.SetActiveGameMode(this.pMode);
 }