コード例 #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.BurlyWood);

            // TODO: Add your drawing code here
            _spriteBatch.Begin(SpriteSortMode.Deferred,
                               BlendState.AlphaBlend,
                               null, null, null, null,
                               camera.Transform);

            lv1.Draw(_spriteBatch);

            hero.Draw(_spriteBatch);

            _spriteBatch.End();

            base.Draw(gameTime);
        }
コード例 #2
0
        /// <summary>
        /// Draws the Screen
        /// </summary>
        /// <param name="gameTime">the game's time</param>
        public override void Draw(GameTime gameTime)
        {
            // This game has a blue background. Why? Because!
            ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.SeaGreen, 0, 0);

            // Our player and enemy are both actually just text strings.
            var spriteBatch = ScreenManager.SpriteBatch;

            //spriteBatch.Begin(samplerState: SamplerState.PointClamp);



            //Levels state machine
            switch (levelState)
            {
            case LevelState.Start:
                spriteBatch.Begin(samplerState: SamplerState.PointClamp);
                spriteBatch.DrawString(bangers, "Welcome Warrior For Fun!", new Vector2(175, 100), Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0);
                spriteBatch.DrawString(bangers, "WASD to move and arrows to attack", new Vector2(105, 150), Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0);
                spriteBatch.DrawString(bangers, "Slay all enemies to progress stages", new Vector2(95, 200), Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0);
                spriteBatch.DrawString(bangers, "Press [Space] to Begin!", new Vector2(195, 250), Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0);
                spriteBatch.End();
                break;

            case LevelState.Zero:
                spriteBatch.Begin(samplerState: SamplerState.PointClamp);
                level0.Draw(gameTime, spriteBatch);
                spriteBatch.DrawString(bangers, "" + gameTime.TotalGameTime, Vector2.Zero, Color.White);
                spriteBatch.End();
                break;

            case LevelState.One:
                spriteBatch.Begin(samplerState: SamplerState.PointClamp);
                level1.Draw(gameTime, spriteBatch);
                spriteBatch.DrawString(bangers, "" + gameTime.TotalGameTime, Vector2.Zero, Color.White);
                spriteBatch.End();
                break;

            case LevelState.Two:
                ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.CadetBlue, 0, 0);
                level2.Draw(gameTime, spriteBatch);
                break;

            case LevelState.EndW:
                spriteBatch.Begin(samplerState: SamplerState.PointClamp);
                spriteBatch.DrawString(bangers, "You Have WON!!!!", new Vector2(243, 100), Color.Gold, 0f, new Vector2(0, 0), 1.25f, SpriteEffects.None, 0);
                spriteBatch.DrawString(bangers, "Press [Space] to go to the main menu", new Vector2(30, 150), Color.Gold, 0f, new Vector2(0, 0), 1.25f, SpriteEffects.None, 0);
                spriteBatch.DrawString(bangers, "or [Esc] to open the menu", new Vector2(150, 200), Color.Gold, 0f, new Vector2(0, 0), 1.25f, SpriteEffects.None, 0);
                spriteBatch.DrawString(bangers, "" + gameTime.ElapsedGameTime + " Not bad, but can you do better?", new Vector2(10, 250), Color.Gold, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);
                spriteBatch.End();
                break;

            case LevelState.EndL:
                spriteBatch.Begin(samplerState: SamplerState.PointClamp);
                spriteBatch.DrawString(bangers, "You Have DIED!!!", new Vector2(243, 100), Color.Red, 0f, new Vector2(0, 0), 1.25f, SpriteEffects.None, 0);
                spriteBatch.DrawString(bangers, "Press [Space] to go to the main menu", new Vector2(30, 150), Color.Red, 0f, new Vector2(0, 0), 1.25f, SpriteEffects.None, 0);
                spriteBatch.DrawString(bangers, "or [Esc] to open the menu", new Vector2(150, 200), Color.Red, 0f, new Vector2(0, 0), 1.25f, SpriteEffects.None, 0);
                spriteBatch.DrawString(bangers, _time + " Not bad, but can you do better?", new Vector2(10, 250), Color.Red, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);
                spriteBatch.End();
                break;
            }

            //spriteBatch.DrawString(_gameFont, "// TODO", _playerPosition, Color.Green);
            //spriteBatch.DrawString(_gameFont, "Insert Gameplay Here",
            //                      _enemyPosition, Color.DarkRed);

            //spriteBatch.End();

            // If the game is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0 || _pauseAlpha > 0)
            {
                float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, _pauseAlpha / 2);

                ScreenManager.FadeBackBufferToBlack(alpha);
            }
        }
コード例 #3
0
        protected void DrawLevel()
        {
            switch (levelNumber)
            {
            case 1:
                levelOne.Draw(spriteBatch, graphics);

                break;

            case 2:
                levelTwo.Draw(spriteBatch, graphics);
                break;

            case 3:
                levelThree.Draw(spriteBatch, graphics);
                break;

            case 4:

                if (!transition)
                {
                    levelFour.DrawConvo(spriteBatch, graphics);
                }
                levelFour.Draw(spriteBatch, graphics);
                break;

            case 5:

                if (!transition)
                {
                    levelFive.DrawConvo(spriteBatch, graphics);
                }

                levelFive.Draw(spriteBatch, graphics);
                break;

            case 6:
                levelSix.Draw(spriteBatch, graphics);
                break;

            case 7:
                levelSeven.Draw(spriteBatch, graphics);
                level7Inst.Play();
                break;

            case 8:
                levelEight.Draw(spriteBatch, graphics);
                break;

            case 9:
                levelNine.Draw(spriteBatch, graphics);
                break;

            case 10:
                levelTen.Draw(spriteBatch, graphics);
                break;

            case 11:
                levelEle.Draw(spriteBatch, graphics);
                break;

            case 12:
                levelTwe.Draw(spriteBatch, graphics);
                break;

            case 13:
                levelTteen.Draw(spriteBatch, graphics);
                break;

            case 14:
                levelFourteen.Draw(spriteBatch, graphics);
                break;

            case 15:
                levelFifteen.Draw(spriteBatch, graphics);
                break;

            case 16:
                levelSixteen.Draw(spriteBatch, graphics);
                break;

            case 17:
                levelSeventeen.Draw(spriteBatch, graphics);
                break;

            default:
                break;
            }


            //spriteBatch.Draw(theOne.Sprite, new Rectangle(theOne.posX, theOne.posY, theOne.Sprite.Width, theOne.Sprite.Height), Color.White);
            if (walkingRight)
            {
                theOneSprRight.Draw(spriteBatch, new Vector2(theOne.posX, theOne.posY));
            }
            else
            {
                theOneSprLeft.Draw(spriteBatch, new Vector2(theOne.posX, theOne.posY));
            }

            if (transition)
            {
                spriteBatch.Draw(transitionBackground, new Rectangle((int)transitionPos.X, (int)transitionPos.Y, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);
                if (levelNumber == 10)
                {
                    SongTransition();
                }
            }
        }