private void resetGame()
        {
            playerManager.playerSprite.Location = playerStartLocation;
            foreach (Sprite asteroid in asteroidManager.Asteroids)
            {
                asteroid.Location = new Vector2(-500, -500);
            }
            enemyManager.Enemies.Clear();
            enemyManager.Active = true;
            playerManager.PlayerShotManager.Shots.Clear();
            enemyManager.EnemyShotManager.Shots.Clear();
            playerManager.Destroyed    = false;
            playerManager.PowerupLevel = 1;
            SoundManager.StopSong();

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            //Add something to stop audio playing here.
        }
Ejemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen = Content.Load <Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load <Texture2D>(@"Textures\SpriteSheet");

            comicSansFont = Content.Load <SpriteFont>(@"Fonts\ComicSans");

            starField = new StarField(this.Window.ClientBounds.Width, this.Window.ClientBounds.Height,
                                      200, new Vector2(0, 30f), spriteSheet, new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(10, spriteSheet, new Rectangle(0, 0, 50, 50),
                                                  20, this.Window.ClientBounds.Width, this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(spriteSheet, new Rectangle(0, 150, 50, 50), 3,
                                              new Rectangle(0, 0, this.Window.ClientBounds.Width, this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(spriteSheet, new Rectangle(0, 200, 50, 50), 6, playerManager,
                                            new Rectangle(0, 0, this.Window.ClientBounds.Width, this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(spriteSheet, new Rectangle(0, 100, 50, 50), 3,
                                                    new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(asteroidManager, playerManager, enemyManager, explosionManager);

            SoundManager.Initialize(Content);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");


            Song song = Content.Load<Song>(@"Sounds\Requiem");  // Put the name of your song in instead of "song_title"
            MediaPlayer.Play(song);


            starField = new StarField(this.Window.ClientBounds.Width,this.Window.ClientBounds.Height,200,
                new Vector2(0, 30f),spriteSheet,new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(10,spriteSheet,new Rectangle(0, 0, 50, 50),20,
                this.Window.ClientBounds.Width,this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(spriteSheet,new Rectangle(0, 150, 50, 50),3,
                new Rectangle(0,0,this.Window.ClientBounds.Width,this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(spriteSheet,new Rectangle(0, 200, 50, 50),6,playerManager,
                new Rectangle(0,0,this.Window.ClientBounds.Width,this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(spriteSheet,new Rectangle(0, 100, 50, 50),3,new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(asteroidManager,playerManager,enemyManager,explosionManager);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");
            // TODO: use this.Content to load your game content here
            SoundManager.Initialize(Content);
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            titleScreen     = Content.Load <Texture2D>(@"Textures/TitleScreen");
            spriteSheet     = Content.Load <Texture2D>(@"Textures/SpriteSheet");
            starField       = new StarField(Window.ClientBounds.Width, Window.ClientBounds.Height, 200, new Vector2(0, 30f), spriteSheet, new Rectangle(0, 450, 2, 2));
            asteroidManager = new AsteroidManager(10, spriteSheet, new Rectangle(0, 0, 50, 50), 20, Window.ClientBounds.Width, Window.ClientBounds.Height);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,    
                new Rectangle(0, 150, 50, 50),    
                3,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen = Content.Load <Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load <Texture2D>(@"Textures\spriteSheet");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(185, 275, 70, 100),    //Start X Y Width Height
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            HomeScreen  = Content.Load <Texture2D>(@"Textures\HomeScreen");
            spriteSheet = Content.Load <Texture2D>(@"Textures\spriteSheet");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                14,
                spriteSheet,
                new Rectangle(472, 208, 52, 49),
                1,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(0, 326, 50, 100),
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(316, 210, 46, 46),
                1,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load <SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 8
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen = Content.Load <Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load <Texture2D>(@"Textures\spriteSheet");
            bbb         = Content.Load <Texture2D>(@"Textures\bbb");
            song        = Content.Load <Song>(@"Sounds\song");
            MediaPlayer.Play(song);

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                100,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(579, 95, 20, 20));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(354, 68, 62, 54),
                1,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(471, 97, 98, 46),
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(158, 143, 82, 53),
                1,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(158, 143, 82, 53),
                1,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load <SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 9
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");
            SuperSprite = Content.Load<Texture2D>(@"Textures\SuperSprite");
            krypton = Content.Load<Texture2D>(@"Textures\krypton");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 8, 8));

            starField1 = new StarField(
               this.Window.ClientBounds.Width,
               this.Window.ClientBounds.Height,
               200,
               new Vector2(0, 30f),
               spriteSheet,
               new Rectangle(0, 450, 4, 4));

            starField2 = new StarField(
               this.Window.ClientBounds.Width,
               this.Window.ClientBounds.Height,
               200,
               new Vector2(0, 30f),
               spriteSheet,
               new Rectangle(0, 450, 8, 8));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                SuperSprite,    
                new Rectangle(0, 0, 51, 64),    
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 10
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen = Content.Load <Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load <Texture2D>(@"Textures\spriteSheet");
            SuperSprite = Content.Load <Texture2D>(@"Textures\SuperSprite");
            krypton     = Content.Load <Texture2D>(@"Textures\krypton");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 8, 8));

            starField1 = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 4, 4));

            starField2 = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 8, 8));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                SuperSprite,
                new Rectangle(0, 0, 51, 64),
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load <SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            EffectManager.Initialize(this.graphics, this.Content);
            EffectManager.LoadContent();

            titleScreen = Content.Load <Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load <Texture2D>(@"Textures\spriteSheet");
            planetSheet = Content.Load <Texture2D>(@"Textures\PlanetSheet");
            levelScreen = Content.Load <Texture2D>(@"Textures\LevelSelect");
            ccViewer    = Content.Load <Texture2D>(@"Textures\CheatCodes");
            credits     = Content.Load <Texture2D>(@"Textures\Credits");
            weedBG      = Content.Load <Texture2D>(@"Textures\420");


            planetManager = new PlanetManager(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                new Vector2(0, 40f),
                planetSheet);


            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                10,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(170, 265, 50, 85),
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load <SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            EffectManager.Update(gameTime);

            // TODO: Add your update logic here
            KeyboardState kb = Keyboard.GetState();

            switch (gameState)
            {
            case GameStates.TitleScreen:
                SoundManager.StopSong();
                titleScreenTimer +=
                    (float)gameTime.ElapsedGameTime.TotalSeconds;

                if (titleScreenTimer >= titleScreenDelayTime)
                {
                    if ((Keyboard.GetState().IsKeyDown(Keys.Space)) ||
                        (GamePad.GetState(PlayerIndex.One).Buttons.A ==
                         ButtonState.Pressed))
                    {
                        playerManager.LivesRemaining = playerStartingLives;
                        playerManager.PlayerScore    = 0;
                        resetGame();
                        gameState = GameStates.DifficultySelect;
                    }
                }
                break;


            case GameStates.CreditsScreen:

                if (kb.IsKeyDown(Keys.R))
                {
                    gameState = GameStates.TitleScreen;
                }

                break;

            case GameStates.Pause:
                if (kb.IsKeyDown(Keys.P))
                {
                    gameState = GameStates.Playing;
                }

                break;

            case GameStates.DifficultySelect:
                //WORK ON DIFFICULTY

                if (kb.IsKeyDown(Keys.D1))
                {
                    //CHANGING DIFFICULTY LEVEL
                    difficultyLevel = 1;
                    gameState       = GameStates.Playing;
                    //LIVES - 1, because the game includes 0 as a life.  Total lives are lives remaining + 1.  Fixed it in the display, so life 1 is your last life.
                    playerManager.LivesRemaining = 5;
                    //ENEMIES
                    enemyManager.MinShipsPerWave = 2;
                    enemyManager.MaxShipsPerWave = 4;
                    //ASTEROIDS
                    asteroidManager.minSpeed = 40;
                    asteroidManager.maxSpeed = 80;
                    //SCORES
                    collisionManager.enemyPointValue = 50;

                    for (int i = 0; i < 7; i++)
                    {
                        asteroidManager.AddAsteroid();
                    }
                }
                else if (kb.IsKeyDown(Keys.D2))
                {
                    difficultyLevel = 2;
                    gameState       = GameStates.Playing;
                    playerManager.LivesRemaining     = 2;
                    enemyManager.MinShipsPerWave     = 6;
                    enemyManager.MaxShipsPerWave     = 8;
                    asteroidManager.minSpeed         = 60;
                    asteroidManager.maxSpeed         = 120;
                    collisionManager.enemyPointValue = 100;
                    for (int i = 0; i < 10; i++)
                    {
                        asteroidManager.AddAsteroid();
                    }
                }

                else if (kb.IsKeyDown(Keys.D3))
                {
                    difficultyLevel = 3;
                    gameState       = GameStates.Playing;
                    playerManager.LivesRemaining     = 1;
                    enemyManager.MinShipsPerWave     = 12;
                    enemyManager.MaxShipsPerWave     = 16;
                    asteroidManager.minSpeed         = 100;
                    asteroidManager.maxSpeed         = 140;
                    collisionManager.enemyPointValue = 200;
                    for (int i = 0; i < 13; i++)
                    {
                        asteroidManager.AddAsteroid();
                    }
                }

                else if (kb.IsKeyDown(Keys.D4))
                {
                    difficultyLevel                  = 4;
                    playerManager.isD4               = true;
                    gameState                        = GameStates.Playing;
                    playerManager.LivesRemaining     = 0;
                    enemyManager.MinShipsPerWave     = 20;
                    enemyManager.MaxShipsPerWave     = 24;
                    asteroidManager.minSpeed         = 160;
                    asteroidManager.maxSpeed         = 220;
                    collisionManager.enemyPointValue = 400;

                    playerManager.PowerupLevel = 4;

                    for (int i = 0; i < 15; i++)
                    {
                        asteroidManager.AddAsteroid();
                    }
                }

                else if (kb.IsKeyDown(Keys.D9))     //Survival Mode.  Score = time played.  No enemies.
                {
                    difficultyLevel = 9;
                    gameState       = GameStates.Playing;
                    playerManager.LivesRemaining = 1;
                    enemyManager.MinShipsPerWave = 0;
                    enemyManager.MaxShipsPerWave = 0;
                    asteroidManager.minSpeed     = 200;
                    asteroidManager.maxSpeed     = 300;
                    playerManager.playerSpeed    = 400.0f;

                    for (int i = 0; i < 20; i++)
                    {
                        asteroidManager.AddAsteroid();
                    }
                }



                //Cheat Code Viewer
                else if (kb.IsKeyDown(Keys.D5))
                {
                    gameState = GameStates.ccViewer;
                }

                if (kb.IsKeyDown(Keys.Z))
                {
                    gameState = GameStates.CreditsScreen;
                }
                break;

            case GameStates.ccViewer:
                if (kb.IsKeyDown(Keys.R))
                {
                    gameState = GameStates.DifficultySelect;
                }

                break;

            case GameStates.Playing:

                starField.Update(gameTime);
                asteroidManager.Update(gameTime);
                playerManager.Update(gameTime);
                enemyManager.Update(gameTime);
                explosionManager.Update(gameTime);
                collisionManager.CheckCollisions();
                planetManager.Update(gameTime);

                if (playerManager.Destroyed)
                {
                    SoundManager.PlayPlayerDeath();

                    playerDeathTimer    = 0f;
                    enemyManager.Active = false;
                    playerManager.LivesRemaining--;
                    if (playerManager.LivesRemaining < 0)
                    {
                        gameState = GameStates.GameOver;
                    }
                    else
                    {
                        gameState = GameStates.PlayerDead;
                    }
                }
                //RESET FUNCTION

                if (kb.IsKeyDown(Keys.R))
                {
                    resetGame();
                    gameState = GameStates.DifficultySelect;
                    playerManager.PlayerScore = 0;
                    playerManager.playerSpeed = 320.0f;
                    playerTimePlayed          = 0f;
                    asteroidManager.Clear();
                    playerManager.PowerupLevel = 1;
                }
                //PAUSE FUNCTION
                if (kb.IsKeyDown(Keys.P))
                {
                    gameState = GameStates.Pause;
                }

                //CHEAT CODES FOR LOSERS

                //Press 6 & 9 on Keypad to change lives to 69.
                if (kb.IsKeyDown(Keys.D6) && kb.IsKeyDown(Keys.D9))
                {
                    playerManager.LivesRemaining = 68;
                }

                //KYS
                if (kb.IsKeyDown(Keys.K) && kb.IsKeyDown(Keys.Y) && kb.IsKeyDown(Keys.S))
                {
                    playerManager.Destroyed = true;
                    SoundManager.PlayPlayerDeath();
                }

                //AND THIS IS TO GO EVEN FURTHER BEYOND! (Work on This)
                if (kb.IsKeyDown(Keys.S) && kb.IsKeyDown(Keys.D3))
                {
                    playerManager.playerSpeed  = 480.0f;
                    asteroidManager.minSpeed   = 60;
                    asteroidManager.maxSpeed   = 120;
                    playerManager.PowerupLevel = 2;
                    SoundManager.PlayGoku();
                }

                //Smokemon
                if (kb.IsKeyDown(Keys.D4) && kb.IsKeyDown(Keys.D2) && kb.IsKeyDown(Keys.D0))
                {
                    isWeed = true;
                    SoundManager.PlaySmokemon();
                    //Plays Smokemon, but does not reset when you rest.

                    starField = new StarField(
                        this.Window.ClientBounds.Width,
                        this.Window.ClientBounds.Height,
                        200,
                        new Vector2(0, 30f),
                        weedBG,
                        new Rectangle(0, 0, 800, 600));
                }

                /*
                 * Automatic difficulty adjustment based on your progress
                 * if (difficultyLevel == 4 && playerManager.LivesRemaining > 1 && playerManager.LivesRemaining < 59)
                 * {
                 *  asteroidManager.minSpeed = 170;
                 *  asteroidManager.maxSpeed = 270;
                 * }
                 */
                break;

            case GameStates.PlayerDead:
                playerDeathTimer +=
                    (float)gameTime.ElapsedGameTime.TotalSeconds;


                starField.Update(gameTime);
                asteroidManager.Update(gameTime);
                enemyManager.Update(gameTime);
                playerManager.PlayerShotManager.Update(gameTime);
                explosionManager.Update(gameTime);
                planetManager.Update(gameTime);


                if (playerDeathTimer >= playerDeathDelayTime)
                {
                    resetGame();
                    gameState = GameStates.Playing;
                }
                //RESET FUNCTION
                kb = Keyboard.GetState();
                if (kb.IsKeyDown(Keys.R))
                {
                    resetGame();
                    gameState = GameStates.DifficultySelect;
                    playerManager.PlayerScore = 0;
                    playerManager.playerSpeed = 320.0f;
                    playerTimePlayed          = 0f;
                    asteroidManager.Clear();
                    playerManager.PowerupLevel = 1;
                }

                break;

            case GameStates.GameOver:
                playerDeathTimer +=
                    (float)gameTime.ElapsedGameTime.TotalSeconds;
                starField.Update(gameTime);
                asteroidManager.Update(gameTime);
                enemyManager.Update(gameTime);
                playerManager.PlayerShotManager.Update(gameTime);
                explosionManager.Update(gameTime);
                planetManager.Update(gameTime);

                if (playerDeathTimer >= playerDeathDelayTime)
                {
                    gameState = GameStates.TitleScreen;
                }
                //RESET FUNCTION
                kb = Keyboard.GetState();
                if (kb.IsKeyDown(Keys.R))
                {
                    resetGame();
                    gameState = GameStates.DifficultySelect;
                    playerManager.PlayerScore = 0;
                    playerManager.playerSpeed = 320.0f;
                    playerTimePlayed          = 0f;
                    asteroidManager.Clear();
                    playerManager.PowerupLevel = 1;
                }
                break;
            }

            base.Update(gameTime);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen    = Content.Load <Texture2D>(@"Textures\TitleScreen");
            spriteSheet    = Content.Load <Texture2D>(@"Textures\spriteSheet");
            crossHairsheet = Content.Load <Texture2D>(@"Textures\Crosshair2");

            crosshair = new Sprite(new Vector2(0, 0), crossHairsheet, new Rectangle(0, 0, 48, 48), Vector2.Zero);
            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(0, 150, 50, 50),
                3,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            gunManager = new GunManager();

            SoundManager.Initialize(Content);
            EffectManager.Initialize(graphics, Content);
            EffectManager.LoadContent();

            pericles14 = Content.Load <SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 14
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen = Content.Load<Texture2D>(@"Textures/TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures/SpriteSheet");
            pericles14 = Content.Load<SpriteFont>(@"Fonts/Pericles14");
            starField = new StarField(this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                250,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0,450,2,2));
            asteroidManager = new AsteroidManager(10, spriteSheet, new Rectangle(0, 0, 50, 50), 20,
                                                  this.Window.ClientBounds.Width, this.Window.ClientBounds.Height);
            playerManager = new PlayerManager(spriteSheet, new Rectangle(0, 150, 50, 50), 3,
                                              new Rectangle(0, 0, this.Window.ClientBounds.Width,
                                                            this.Window.ClientBounds.Height));
            enemyManager = new EnemyManager(spriteSheet,
                new Rectangle(0,200,50,50),
                6,
                playerManager,
                new Rectangle(
                    0,0,this.Window.ClientBounds.Width, this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(spriteSheet, new Rectangle(0, 100, 50, 50), 3,
                                                    new Rectangle(0, 450, 2, 2));

            collisionmanager = new CollisionManager(asteroidManager, playerManager, enemyManager, explosionManager);
            SoundManager.Initialize(Content);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            deathStar = Content.Load<Sprite>(@"Textures\DeathStar");
            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");

            camera = new Camera(new Viewport(0, 0, this.Window.ClientBounds.Width, this.Window.ClientBounds.Height));
            camera.Origin = new Vector2(camera.ViewPort.Width / 2.0f, camera.ViewPort.Height);

            camera.Zoom = 1f;

            


            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,    
                new Rectangle(0, 150, 50, 50),    
                3,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2),
                camera);

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");
            


            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 16
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen = Content.Load <Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load <Texture2D>(@"Textures\spriteSheet");
            spaceSheet  = Content.Load <Texture2D>(@"Textures\spaceSheet");


            Song song = Content.Load <Song>(@"Sounds\brawl");  // Put the name of your song here instead of "song_title"

            MediaPlayer.Play(song);

            SpriteCreators.Load(@"Content\SpaceSheet.txt");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                100,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            starField2 = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                100,
                new Vector2(0, 25f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            starField3 = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                100,
                new Vector2(0, 35f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            planet = new Planets(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                1,
                new Vector2(0, 20f),
                spaceSheet);

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(0, 150, 50, 50),
                3,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load <SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 17
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");
            bbb = Content.Load<Texture2D>(@"Textures\bbb");
            song = Content.Load<Song>(@"Sounds\song");
            MediaPlayer.Play(song);

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                100,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(579, 95, 20, 20));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(354, 68, 62, 54),
                1,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,    
                new Rectangle(471, 97, 98, 46),    
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(158, 143, 82, 53),
                1,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(158, 143, 82, 53),
                1,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 18
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            HomeScreen = Content.Load<Texture2D>(@"Textures\HomeScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                14,
                spriteSheet,
                new Rectangle(472, 208, 52, 49),
                1,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,    
                new Rectangle(0, 326, 50, 100),    
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(316, 210, 46, 46),
                1,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }