Esempio n. 1
0
        public void Draw(SpriteBatch sb)
        {
            scrollingBackground.Draw(sb);
            uI.Draw(sb);
            player.Draw(sb);

            if (projectiles != null)
            {
                foreach (Projectiles p in projectiles)
                {
                    p.Draw(sb);
                }
            }

            if (meteors != null)
            {
                foreach (Meteor m in meteors)
                {
                    m.Draw(sb);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin();
            player.Draw(spriteBatch);
            playerBase.Draw(spriteBatch);

            foreach (Bullet bullet in bullets)
            {
                bullet.Draw(spriteBatch);
            }

            if (winner)
            {
                spriteBatch.DrawString(font, "You've won!", new Vector2(500, 500), Color.White);
            }
            spriteBatch.End();

            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
Esempio n. 3
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            // TODO: Add your drawing code here

            switch (gameState)
            {
            case State.Menu:
                spriteBatch.Begin();
                menus.ForEach(x => x.Draw(spriteBatch));
                buttons.ForEach(x => x.Draw(spriteBatch));
                buttons.ForEach(x => x.TextDraw(spriteBatch));
                spriteBatch.End();
                return;

            case State.Play:
                spriteBatch.Begin();
                player.Draw(spriteBatch);
                collider.ForEach(x => x.Draw(spriteBatch));
                spriteBatch.End();
                return;
            }
            base.Draw(gameTime);
        }
Esempio n. 4
0
        protected override void Draw(GameTime gameTime)
        {
            switch (gameState)
            {
            case GameState.Intro:
            {
                spriteBatch.Begin();

                videoTexture = videoplayer.GetTexture();
                if (videoTexture != null)
                {
                    spriteBatch.Draw(videoTexture, videoScreen, Color.White);
                }
                spriteBatch.End();
                break;
            }

            case GameState.TitleScreen:
            {
                spriteBatch.Begin();
                bgSpace.Draw(gameTime);
                spriteBatch.DrawString(sFont1, "MAIN MENU", pos_main_title, Color.White);
                spriteBatch.DrawString(sFont1, "Press 'E' to start the game!", txt_IntroPos, Color.White);
                spriteBatch.DrawString(sFont1, "Press 'F' to pause the game!", pos_main_pause, Color.White);
                spriteBatch.DrawString(sFont1, "Press 'Escape' to quit the game!", pos_main_quit, Color.White);
                spriteBatch.DrawString(sFont1, "Controls:", txt_ControlsPos, Color.White);
                spriteBatch.DrawString(sFont1, "Use WASD to move", txt_ControlsPos1, Color.White);
                spriteBatch.DrawString(sFont1, "Press 'Space' to shoot", txt_ControlsPos2, Color.White);
                spriteBatch.End();
                break;
            }

            case GameState.GameStarted:
            {
                spriteBatch.Begin();
                bgSpace.Draw(gameTime);
                if (player.isAlive)
                {
                    player.Draw(spriteBatch);
                    em.Draw(spriteBatch);
                    pum.Draw(spriteBatch);
                    //draw Score
                    spriteBatch.DrawString(sFont1, "Score: " + player.score.ToString(), txt_ScorePos, Color.White);
                }
                else
                {
                    spriteBatch.DrawString(sFont2, "Game Over", txt_GameOverPos, Color.White);
                    spriteBatch.DrawString(sFont1, "Score:   " + score, txt_ScorePos2, Color.White);
                    spriteBatch.DrawString(sFont1, "Press 'E' to continue!", txt_ContinuePos, Color.White);
                    spriteBatch.DrawString(sFont1, "Press 'Escape' to Exit", txt_ExitPos, Color.White);
                }
                spriteBatch.End();
                break;
            }

            case GameState.GameEnded:
            {
                break;
            }

            case GameState.GamePaused:
            {
                spriteBatch.Begin();
                bgSpace.Draw(gameTime);
                player.Draw(spriteBatch);
                em.Draw(spriteBatch);
                pum.Draw(spriteBatch);
                spriteBatch.DrawString(sFont1, "Score: " + player.score.ToString(), txt_ScorePos, Color.White);
                spriteBatch.DrawString(sFont1, "PAUSE", pos_pause_title, Color.White);
                spriteBatch.DrawString(sFont1, "Continue:  E", pos_pause_continue, Color.White);
                spriteBatch.DrawString(sFont1, "Restart:   R", pos_pause_restart, Color.White);
                spriteBatch.DrawString(sFont1, "Quit:      Escape", pos_pause_exit, Color.White);
                spriteBatch.End();
                break;
            }
            }
            base.Draw(gameTime);
        }
Esempio n. 5
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here

            // Start drawing
            spriteBatch.Begin();

            //Draw the Main Background Texture
            spriteBatch.Draw(mainBackground, rectBackground, Color.White);

            // Draw the moving background
            bgLayer1.Draw(spriteBatch);
            bgLayer2.Draw(spriteBatch);

            // Draw the Enemies
            for (int i = 0; i < enemies.Count; i++)
            {
                enemies[i].Draw(spriteBatch);
            }


            // draw explosions
            foreach (var e in explosions)
            {
                e.Draw(spriteBatch);
            }
            ;



            // Draw the Player
            player2.Draw(spriteBatch);
            player.Draw(spriteBatch);


            //[TEST CODE-IGNORE]
            //player2.Draw(spriteBatch);
            //spriteBatch.DrawString(font, "Score", new Vector2(100, 100), Color.Black);
            spriteBatch.DrawString(font, "Orange Score: " + score, new Vector2(20, 20), Color.Orange);
            spriteBatch.DrawString(font, "Green Score: " + score2, new Vector2(300, 20), Color.Green);
            spriteBatch.DrawString(font, "Avoid Getting Hit!!", new Vector2(20, 550), Color.Gold);

            //[First Concept, Improved to more logical]
            //if ((score >= 5 && score <=15) || (score2 >= 5 && score2 <= 15))
            //{
            //    spriteBatch.DrawString(font, "Orange LEFT key changed to 'M'!", new Vector2(300, 550), Color.Red);
            //    lock_left = 1;
            //}

            if (score + score2 >= 10 && score + score2 <= 30)
            {
                spriteBatch.DrawString(font, "Orange LEFT key changed to 'M'!", new Vector2(300, 550), Color.Orange);
                lock_left = 1;
            }

            if (score + score2 >= 31 && score + score2 <= 60)
            {
                spriteBatch.DrawString(font, "", new Vector2(300, 550), Color.White);
                spriteBatch.DrawString(font, "Green RIGHT changed to 'P'!", new Vector2(300, 550), Color.Green);
                lock_left = 0;
                lock_d    = 1;
            }


            if (score + score2 >= 61 && score + score2 <= 90)
            {
                spriteBatch.DrawString(font, "", new Vector2(300, 550), Color.White);
                spriteBatch.DrawString(font, "Orange UP changed to 'Q'!", new Vector2(300, 550), Color.Orange);
                lock_d  = 0;
                lock_up = 1;
            }

            if (score + score2 >= 91 && score + score2 <= 120)
            {
                spriteBatch.DrawString(font, "", new Vector2(300, 550), Color.White);
                spriteBatch.DrawString(font, "Green UP changed to 'Q'!", new Vector2(300, 550), Color.Green);
                lock_d  = 0;
                lock_up = 1;
            }

            if (score + score2 >= 121)
            {
                spriteBatch.DrawString(font, "", new Vector2(300, 550), Color.White);
                if (score > score2)
                {
                    spriteBatch.DrawString(font, "Orange Win!!!", new Vector2(400, 400), Color.Black);
                }

                if (score2 > score)
                {
                    spriteBatch.DrawString(font, "Green Win!!!", new Vector2(400, 400), Color.Black);
                }
            }



            //Vector2 location = new Vector2(400, 240);
            //Rectangle sourceRectangle = new Rectangle(0, 0, arrow.Width, arrow.Height);
            //Vector2 origin = new Vector2(0, 0);

            //spriteBatch.Draw(arrow, location, sourceRectangle, Color.White, angle, origin, 1.0f, SpriteEffects.None, 1);

            //Vector2 location2 = new Vector2(600, 400);
            //Rectangle sourceRectangle2 = new Rectangle(0, 0, arrow.Width, arrow.Height);
            //Vector2 origin2 = new Vector2(0, 0);

            //spriteBatch.Draw(arrow2, location2, sourceRectangle2, Color.White, angle, origin, 1.0f, SpriteEffects.None, 1);

            // Stop drawing
            spriteBatch.End();

            base.Draw(gameTime);
        }
Esempio n. 6
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);
            spriteBatch.Begin();


            switch (state)
            {
            case GameState.Start:
            {
                spriteBatch.Draw(Background, backrect, randomcolor);
                spriteBatch.Draw(Background, backrect2, randomcolor);
                spriteBatch.DrawString(spriteFont, "Super Robo W.H.A.L.E.", textLoc, Color.Crimson);
                spriteBatch.Draw(Button, Startbutton, Color.White);
                spriteBatch.Draw(Button, optionsbutton, Color.White);
                spriteBatch.Draw(Button, exitbutton, Color.White);
                spriteBatch.DrawString(spriteFont, "Start", new Vector2(Startbutton.X + 20, Startbutton.Y + 8), Color.Black, 0f, new Vector2(0, 0), .5f, SpriteEffects.None, 1f);
                spriteBatch.DrawString(spriteFont, "Options", new Vector2(optionsbutton.X + 8, optionsbutton.Y + 8), Color.Black, 0f, new Vector2(0, 0), .5f, SpriteEffects.None, 1f);
                spriteBatch.DrawString(spriteFont, "Exit", new Vector2(exitbutton.X + 27, exitbutton.Y + 8), Color.Black, 0f, new Vector2(0, 0), .5f, SpriteEffects.None, 1f);
                break;
            }        // END OF START MENU

            case GameState.inGame:
            {
                you.Draw(spriteBatch);
                //spriteBatch.Draw(Platform, platformplace, Color.AliceBlue);
                //spriteBatch.Draw(Platform, platformplace2, Color.AliceBlue);
                //  Draw platforms

                spriteBatch.Draw(Background, backrect, randomcolor);
                spriteBatch.Draw(Background, backrect2, randomcolor);
                spriteBatch.DrawString(spriteFont, "Score: " + score, new Vector2(10, 10), Color.Black);
                spriteBatch.Draw(Platform, platform1.platform, randomcolor);
                spriteBatch.Draw(Platform, platform2.platform, randomcolor);
                spriteBatch.Draw(Platform, platform3.platform, randomcolor);
                spriteBatch.Draw(Platform, platform4.platform, randomcolor);
                spriteBatch.Draw(enemy, A.hitbox, randomcolor);
                spriteBatch.Draw(enemy, B.hitbox, randomcolor);
                spriteBatch.Draw(rocket, projectile2, Color.White);
                spriteBatch.Draw(rocket, projectile3, Color.White);
                spriteBatch.Draw(you.sprite, you.position, randomcolor);
                if (colorchanger == 1)
                {
                    switch (dogecounter)
                    {
                    case 0:
                        break;

                    case 1:
                        break;

                    case 2:
                        spriteBatch.DrawString(spriteFont, "Such WOW", new Vector2(rnd.Next(0, GraphicsDevice.Viewport.Width), rnd.Next(0, GraphicsDevice.Viewport.Height)), Color.Violet);
                        break;

                    case 3:
                        spriteBatch.DrawString(spriteFont, "Much Win", new Vector2(rnd.Next(0, GraphicsDevice.Viewport.Width), rnd.Next(0, GraphicsDevice.Viewport.Height)), Color.Red);
                        break;

                    case 4:
                        spriteBatch.DrawString(spriteFont, "SUPER WHALE", new Vector2(rnd.Next(0, GraphicsDevice.Viewport.Width), rnd.Next(0, GraphicsDevice.Viewport.Height)), Color.White);
                        break;

                    case 5:
                        spriteBatch.DrawString(spriteFont, "Dude", new Vector2(rnd.Next(0, GraphicsDevice.Viewport.Width), rnd.Next(0, GraphicsDevice.Viewport.Height)), Color.Olive);
                        break;

                    case 6:
                        spriteBatch.DrawString(spriteFont, "WOAH", new Vector2(rnd.Next(0, GraphicsDevice.Viewport.Width), rnd.Next(0, GraphicsDevice.Viewport.Height)), Color.Green);
                        break;

                    case 7:
                        spriteBatch.DrawString(spriteFont, "AAAAAA-IIII-EEEE-OOO-UUUU", new Vector2(rnd.Next(0, GraphicsDevice.Viewport.Width), rnd.Next(0, GraphicsDevice.Viewport.Height)), Color.Blue);
                        break;

                    case 8:
                        break;

                    case 9:
                        break;
                    }
                }


                //  Draw player
                // you.Draw(spriteBatch);
                if (Lazoron)
                {
                    spriteBatch.Draw(Background, projectile, Color.Crimson);
                }
                break;
            }        //END OF IN-GAME

            case GameState.Options:
            {
                if (prevState != GameState.Start)
                {
                    spriteBatch.Draw(Background, backrect, randomcolor);
                    spriteBatch.Draw(Background, backrect2, randomcolor);
                    spriteBatch.DrawString(spriteFont, "Score: " + score, new Vector2(10, 10), Color.Black);
                    spriteBatch.Draw(Platform, platform1.platform, Color.White);
                    spriteBatch.Draw(Platform, platform2.platform, Color.White);
                    spriteBatch.Draw(Platform, platform3.platform, Color.White);
                    spriteBatch.Draw(Platform, platform4.platform, Color.White);
                    spriteBatch.Draw(enemy, A.hitbox, Color.White);
                    spriteBatch.Draw(enemy, B.hitbox, Color.White);
                    spriteBatch.Draw(rocket, projectile2, Color.White);
                    spriteBatch.Draw(rocket, projectile3, Color.White);

                    you.Draw(spriteBatch);
                }
                spriteBatch.Draw(Background, backrect, randomcolor);
                spriteBatch.Draw(Background, backrect2, randomcolor);
                spriteBatch.Draw(Button, Backbutton, Color.White);
                spriteBatch.DrawString(spriteFont, "Back", new Vector2(Backbutton.X + 27, Backbutton.Y + 8), Color.Black, 0f, new Vector2(0, 0), .5f, SpriteEffects.None, 1f);

                spriteBatch.DrawString(spriteFont, "OPTIONS \n(of which you have none)", textLoc, Color.Black);
                break;
            }        //END OG OPTIONS MENU

            case GameState.Pause:
            {
                spriteBatch.Draw(Background, backrect, randomcolor);
                spriteBatch.Draw(Background, backrect2, randomcolor);
                spriteBatch.DrawString(spriteFont, "Score: " + score, new Vector2(10, 10), Color.Black);
                spriteBatch.Draw(Platform, platform1.platform, Color.White);
                spriteBatch.Draw(Platform, platform2.platform, Color.White);
                spriteBatch.Draw(Platform, platform3.platform, Color.White);
                spriteBatch.Draw(Platform, platform4.platform, Color.White);
                spriteBatch.Draw(enemy, A.hitbox, Color.White);
                spriteBatch.Draw(enemy, B.hitbox, Color.White);
                spriteBatch.Draw(rocket, projectile2, Color.White);
                spriteBatch.Draw(rocket, projectile3, Color.White);

                you.Draw(spriteBatch);
                spriteBatch.Draw(Button, optionsbutton, Color.White);
                spriteBatch.DrawString(spriteFont, "Options", new Vector2(optionsbutton.X + 8, optionsbutton.Y + 8), Color.Black, 0f, new Vector2(0, 0), .5f, SpriteEffects.None, 1f);
                spriteBatch.Draw(Button, Resumebutton, Color.White);
                spriteBatch.DrawString(spriteFont, "Resume", new Vector2(Resumebutton.X + 8, Resumebutton.Y + 8), Color.Black, 0f, new Vector2(0, 0), .5f, SpriteEffects.None, 1f);
                spriteBatch.Draw(Button, Menubutton, Color.White);
                spriteBatch.DrawString(spriteFont, "Menu", new Vector2(Menubutton.X + 20, Menubutton.Y + 8), Color.Black, 0f, new Vector2(0, 0), .5f, SpriteEffects.None, 1f);

                spriteBatch.DrawString(spriteFont, "Game Paused", new Vector2(textLoc.X + 100, 200), Color.Crimson);
                break;
            }        //END OF PAUSE MENU

            case GameState.gameOver:
            {
                spriteBatch.Draw(Background, backrect, randomcolor);
                spriteBatch.Draw(Background, backrect2, randomcolor);
                spriteBatch.DrawString(spriteFont, "You tried.", textLoc2, Color.Black);
                spriteBatch.Draw(Button, Backbutton, Color.White);
                spriteBatch.DrawString(spriteFont, "Back", new Vector2(Backbutton.X + 27, Backbutton.Y + 8), Color.Black, 0f, new Vector2(0, 0), .5f, SpriteEffects.None, 1f);
                Rectangle trophyRect = new Rectangle(450, 170, 300, 300);
                Rectangle starRect   = new Rectangle(50, 150, 250, 250);
                spriteBatch.Draw(trophy, trophyRect, Color.White);
                spriteBatch.Draw(star, starRect, Color.White);
                break;
            }        //END OF GAME OVER MENU
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }
Esempio n. 7
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            //backgroundImage.Draw(spriteBatch);

            foreach (Bullet bullet in playerBullets)
            {
                bullet.Draw(spriteBatch);
            }

            foreach (Bullet bullet in invaderBullets)
            {
                bullet.Draw(spriteBatch);
            }

            foreach (List <Invader> invadersList in invaders)
            {
                foreach (Invader invader in invadersList)
                {
                    invader.Draw(spriteBatch);
                }
            }

            player.Draw(spriteBatch);

            if (currentState == GameState.GameOver)
            {
                spriteBatch.Begin();
                string text = "PRESS 'R' IN ORDER TO RESTART";
                spriteBatch.DrawString(
                    font,
                    text,
                    new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2) - (font.MeasureString(text) / 2),
                    Color.Black);
                spriteBatch.End();
            }

            if (currentState == GameState.Restarting)
            {
                spriteBatch.Begin();
                string text = "RESTARTING IN " + Math.Round((double)restartingCounter / 60) + "!";
                spriteBatch.DrawString(
                    font,
                    text,
                    new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2) - (font.MeasureString(text) / 2),
                    Color.Black);
                spriteBatch.End();
            }

            if (currentState == GameState.Victory)
            {
                spriteBatch.Begin();
                string text = "VICTORY!!!";
                spriteBatch.DrawString(
                    font,
                    text,
                    new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2) - (font.MeasureString(text) / 2),
                    Color.Black);

                string text2 = "PRESS 'R' IN ORDER TO RESTART";
                spriteBatch.DrawString(
                    font,
                    text2,
                    new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2 + 30) - (font.MeasureString(text2) / 2),
                    Color.Black);
                spriteBatch.End();
            }



            base.Draw(gameTime);
        }