Ejemplo n.º 1
0
        public gamePhase HandleInput(ButtonEvents bEvent, gamePhase same, UFOManager ufo, Player player)
        {
            gamePhase result = same;

            if (bEvent.BackPress || bEvent.EscPress)
            {
                // Allows the game to exit
                result = gamePhase.QUIT;
            }
            else if (bEvent.DpadDownPress || bEvent.DownPress)
            {
                // Move difficulty selector down
                difficulty.option = (difficulty.option + 1) % 3;
            }
            else if (bEvent.DpadUpPress || bEvent.UpPress)
            {
                // Move difficulty selector up
                difficulty.option = (difficulty.option + 2) % 3;
            }
            else if (bEvent.StartPress || bEvent.EnterPress)
            {
                // Begin game
                switch (difficulty.option)
                {
                case 0:     //Easy
                    player.level       = 1;
                    player.score       = 0;
                    player.lives       = 10;
                    player.maxBullets  = 8;
                    player.bulletSpeed = 3;
                    player.setSpeedMultiplier(8);
                    break;

                case 1:     //Medium
                    player.level       = 1;
                    player.score       = 0;
                    player.lives       = 5;
                    player.maxBullets  = 2;
                    player.bulletSpeed = 1.5f;
                    player.setSpeedMultiplier(5);
                    break;

                case 2:     //Hard
                    player.level       = 1;
                    player.score       = 0;
                    player.lives       = 3;
                    player.maxBullets  = 1;
                    player.bulletSpeed = 1;
                    player.setSpeedMultiplier(3);
                    break;
                }
                ufo.Destroy();
                result     = gamePhase.LOADLEVEL;
                mFirstPass = true;         //reset splash screen initializer
            }

            return(result);
        }
Ejemplo n.º 2
0
 public void SplashDance(GraphicsDevice gDev, UFOManager ufo)
 {
     if (mFirstPass)
     {
         ufo.SplashCreate(gDev);
         mFirstPass = false;
     }
     ufo.SplashDance(gDev);
 }
Ejemplo n.º 3
0
 public void DetectCollisions(Player player, AlienManager aliens, UFOManager ufo)
 {
     aliens.DetectCollision(player.bullets(), player);
     ufo.DetectCollision(player.bullets(), player.level);
     if (player.DetectCollision(ufo.Gift()))
     {
         ufo.CatchGift(player);
     }
     player.DetectCollision(aliens.bullets());
 }
Ejemplo n.º 4
0
 public void Initialize(Player player, AlienManager aliens, UFOManager ufo)
 {
     if (mTimer == 0)
     {
         player.bullets().Clear();
         aliens.Clear();
         ufo.Destroy();
         aliens.Spawn(player.level);
     }
 }
Ejemplo n.º 5
0
        public bool Update(Starfield stars, Player player, AlienManager aliens, UFOManager ufo, GraphicsDevice gDev)
        {
            bool gameover = false;

            stars.Update(gDev);
            gameover = !aliens.Update(gDev, player.Y);
            ufo.Update(gDev, player);
            player.UpdateBullets();

            return(!gameover);
        }
Ejemplo n.º 6
0
 public void Draw(GraphicsDevice gDev, SpriteBatch sprBatch, Starfield stars, UFOManager ufo)
 {
     stars.Draw(sprBatch);
     sprBatch.DrawString(fontFkey, "F-Key Entertainment presents:", new Vector2(gDev.Viewport.Width * 0.23f, gDev.Viewport.Height * 0.02f), Color.CornflowerBlue);
     sprBatch.DrawString(fontTitle, "Alien", new Vector2(300, -20), new Color(220, 185, 30));
     sprBatch.DrawString(fontTitle, "Incursion", new Vector2(40, 125), new Color(220, 185, 30));
     ufo.SplashDraw(sprBatch, gDev);
     sprBatch.DrawString(fontFkey, "Easy", new Vector2(600, 525), difficulty.color(1));
     sprBatch.DrawString(fontFkey, "Medium", new Vector2(575, 570), difficulty.color(2));
     sprBatch.DrawString(fontFkey, "Hard", new Vector2(600, 615), difficulty.color(3));
     sprBatch.DrawString(fontInstruction, "Select difficulty using D-Pad, Press 'Start' to play", new Vector2(300, 675), Color.LightGray);
 }
Ejemplo n.º 7
0
 public void Draw(SpriteBatch sprBatch, GraphicsDevice gDev, Starfield stars, Player player, AlienManager aliens, UFOManager ufo)
 {
     base.Draw(sprBatch, stars, player, aliens, ufo, true, true);
     sprBatch.DrawString(fontPause, "PAUSE", new Vector2(gDev.Viewport.Width * 0.21f, gDev.Viewport.Height * 0.25f), new Color(180, 15, 20));
 }
Ejemplo n.º 8
0
 public void Draw(SpriteBatch sprBatch, Starfield stars, Player player, AlienManager aliens, UFOManager ufo, bool drawNPCs, bool drawShip)
 {
     stars.Draw(sprBatch);
     if (drawShip)
     {
         player.Draw(sprBatch);
         foreach (Sprite pB in player.bullets())
         {
             pB.Draw(sprBatch);
         }
     }
     if (drawNPCs)
     {
         foreach (Sprite eB in aliens.bullets())
         {
             eB.Draw(sprBatch, (float)Math.PI, Color.Red);
         }
         foreach (Sprite a in aliens.alienList())
         {
             a.Draw(sprBatch);
         }
         if (!ufo.Caught())
         {
             ufo.Draw(sprBatch);
         }
     }
     sprBatch.Draw(mPanel, new Vector2(1080, 0), Color.White);
     sprBatch.DrawString(fontHeader, ("Level   " + player.level), new Vector2(1120, 19), Color.IndianRed);
     sprBatch.DrawString(fontHeader, ("Score"), new Vector2(1135, 95), Color.CadetBlue);
     sprBatch.DrawString(fontData, ("" + player.score), new Vector2(1135, 140), Color.White);
     sprBatch.DrawString(fontHeader, ("Lives:"), new Vector2(1120, 235), Color.CadetBlue);
     sprBatch.DrawString(fontData, ("" + player.lives), new Vector2(1220, 235), Color.White);
     sprBatch.DrawString(fontHeader, ("Ship Speed"), new Vector2(1100, 325), Color.ForestGreen);
     sprBatch.DrawString(fontData, ("" + player.Speed), new Vector2(1162, 374), Color.White);
     sprBatch.DrawString(fontHeader, ("Max Bullets"), new Vector2(1099, 460), Color.ForestGreen);
     sprBatch.DrawString(fontData, ("" + player.maxBullets + " / 8"), new Vector2(1150, 509), Color.White);
     sprBatch.DrawString(fontHeader, ("Bullet Speed"), new Vector2(1095, 600), Color.ForestGreen);
     sprBatch.DrawString(fontData, ("" + player.bulletSpeed), new Vector2(1166, 649), Color.White);
     if (drawNPCs && ufo.Caught())
     {
         ufo.Draw(sprBatch);
     }
 }
Ejemplo n.º 9
0
 public new bool Update(Starfield stars, Player player, AlienManager aliens, UFOManager ufo, GraphicsDevice gDev)
 {
     mTimer++;
     return(base.Update(stars, player, aliens, ufo, gDev));
 }
Ejemplo n.º 10
0
 public void Draw(GraphicsDevice gDev, SpriteBatch spriteBatch, Starfield stars, Player player, AlienManager aliens, UFOManager ufo)
 {
     base.Draw(spriteBatch, stars, player, aliens, ufo, false, false);
     if (player.level < 10)
     {
         spriteBatch.DrawString(fontLevel, ("Level " + player.level), new Vector2(gDev.Viewport.Width * 0.15f, gDev.Viewport.Height * 0.25f), Color.DarkGreen);
     }
     else
     {
         spriteBatch.DrawString(fontLevel, ("Level " + player.level), new Vector2(gDev.Viewport.Width * 0.11f, gDev.Viewport.Height * 0.25f), Color.DarkGreen);
     }
 }
Ejemplo n.º 11
0
 public void Draw(SpriteBatch sprBatch, GraphicsDevice gDev, Starfield stars, Player player, AlienManager aliens, UFOManager ufo)
 {
     base.Draw(sprBatch, stars, player, aliens, ufo, true, false);
     sprBatch.DrawString(fontGameOver, "GAME OVER", new Vector2(gDev.Viewport.Width * 0.07f, gDev.Viewport.Height * 0.3f), new Color(180, 15, 20));
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Initialize game window
            base.Initialize();

            // Everything else
            bEvents = new ButtonEvents(GamePad.GetState(PlayerIndex.One), Keyboard.GetState());
            phase   = gamePhase.DEVINTRO;

            Texture2D[] frames = new Texture2D[31] {
                Content.Load <Texture2D>("Intro/devint-01"),
                Content.Load <Texture2D>("Intro/devint-02"),
                Content.Load <Texture2D>("Intro/devint-03"),
                Content.Load <Texture2D>("Intro/devint-04a"),
                Content.Load <Texture2D>("Intro/devint-04b"),
                Content.Load <Texture2D>("Intro/devint-04a"),
                Content.Load <Texture2D>("Intro/devint-04a"),
                Content.Load <Texture2D>("Intro/devint-04a"),
                Content.Load <Texture2D>("Intro/devint-04b"),
                Content.Load <Texture2D>("Intro/devint-04a"),
                Content.Load <Texture2D>("Intro/devint-04b"),
                Content.Load <Texture2D>("Intro/devint-04a"),
                Content.Load <Texture2D>("Intro/devint-05"),
                Content.Load <Texture2D>("Intro/devint-06"),
                Content.Load <Texture2D>("Intro/devint-07"),
                Content.Load <Texture2D>("Intro/devint-08"),
                Content.Load <Texture2D>("Intro/devint-09"),
                Content.Load <Texture2D>("Intro/devint-10"),
                Content.Load <Texture2D>("Intro/devint-11"),
                Content.Load <Texture2D>("Intro/devint-12"),
                Content.Load <Texture2D>("Intro/devint-13"),
                Content.Load <Texture2D>("Intro/devint-14"),
                Content.Load <Texture2D>("Intro/devint-15"),
                Content.Load <Texture2D>("Intro/devint-16"),
                Content.Load <Texture2D>("Intro/devint-17"),
                Content.Load <Texture2D>("Intro/devint-18"),
                Content.Load <Texture2D>("Intro/devint-19"),
                Content.Load <Texture2D>("Intro/devint-19"),
                Content.Load <Texture2D>("Intro/devint-19"),
                Content.Load <Texture2D>("Intro/devint-19"),
                Content.Load <Texture2D>("Intro/devint-19")
            };

            scrIntro  = new DevIntro(frames, 31);
            scrSplash = new SplashScreen(Content.Load <SpriteFont>("Fonts/Fkey"),
                                         Content.Load <SpriteFont>("Fonts/Title"),
                                         Content.Load <SpriteFont>("Fonts/Instruction"));
            scrLoader = new LevelLoader(Content.Load <SpriteFont>("Fonts/Level"));
            scrPlay   = new PlayScreen(Content.Load <SpriteFont>("Fonts/PlayerHeader"),
                                       Content.Load <SpriteFont>("Fonts/PlayerData"),
                                       Content.Load <Texture2D>("Panel"));
            scrPause    = new PauseScreen(Content.Load <SpriteFont>("Fonts/Pause"));
            scrGameover = new GameOver(Content.Load <SpriteFont>("Fonts/GameOver"));

            stars = new Starfield(GraphicsDevice);

            player = new Player(Content.Load <Texture2D>("Ship"),
                                Content.Load <Texture2D>("Bullet"),
                                Content.Load <SoundEffect>("Sounds/ShipFiring"),
                                Content.Load <SoundEffect>("Sounds/ShipDeath"),
                                new Vector2((GraphicsDevice.Viewport.Width - 200) / 2 - 40, GraphicsDevice.Viewport.Height - 91),
                                new Vector2(0, 0),
                                4.0f);
            aliens = new AlienManager(Content.Load <Texture2D>("alien0"),
                                      Content.Load <Texture2D>("alien1"),
                                      Content.Load <Texture2D>("alien2"),
                                      Content.Load <Texture2D>("alien3"),
                                      Content.Load <Texture2D>("Bullet"),
                                      Content.Load <SoundEffect>("Sounds/AlienFiring"),
                                      Content.Load <SoundEffect>("Sounds/AlienDeath"));
            ufo = new UFOManager(Content.Load <Texture2D>("BigAlien"),
                                 Content.Load <Texture2D>("Present"),
                                 Content.Load <SoundEffect>("Sounds/UFOMoving"),
                                 Content.Load <SoundEffect>("Sounds/GiftboxDrop"),
                                 Content.Load <SoundEffect>("Sounds/GiftboxCollect"));
        }