Exemple #1
0
        public virtual void Draw(SpriteBatch spriteBatch)
        {
            if (heart != null)
            {
                heart.Draw(spriteBatch);

                /*if(heart.Player == null)
                 * {
                 *  heart = null;
                 * }*/
            }
            //spriteBatch.Draw(characterSprite, characterBox, Color.White);
        }
Exemple #2
0
        protected void DrawGame(SpriteBatch spriteBatch, GameTime gameTime)
        {
            gen.Draw(spriteBatch);
            //rangedEnemy.Draw(spriteBatch);
            //meleeEnemy.Draw(spriteBatch);

            // Draw all enemies
            foreach (List <Enemy> enemies in worldEnemies.Values)
            {
                foreach (Enemy enemy in enemies)
                {
                    // check for debugColors bool
                    if (debugColors == true)
                    {
                        enemy.DrawDebug(spriteBatch);
                    }
                    enemy.Draw(spriteBatch);
                }
            }

            // check for debugColors bool
            if (debugColors == true)
            {
                player.DrawDebug(spriteBatch);
            }
            player.Draw(spriteBatch);

            int screenMiddle = GraphicsDevice.Viewport.Width / 2;//gets the midpoint of the current x resolution

            spriteBatch.DrawString(mainFont, "Score: " + player.Score, new Vector2(player.MaxMove + screenMiddle - 195, 10), Color.Black);

            // health bar conditions and drawing

            // draw full bar if health is above fifty
            if (player.Health >= 50)
            {
                spriteBatch.Draw(debugs[0], new Rectangle(15 + player.MaxMove, 10, 300, 16), Color.White);
            }
            // draw red if low
            else if (player.Health <= 15)
            {
                spriteBatch.Draw(debugs[1], new Rectangle(15 + player.MaxMove, 10, player.Health * 6, 16), Color.White);
            }
            // otherwise draw health * 6
            else
            {
                spriteBatch.Draw(debugs[0], new Rectangle(15 + player.MaxMove, 10, player.Health * 6, 16), Color.White);
            }
            // draw health bar on top of debug colors
            spriteBatch.Draw(healthBar, new Vector2(15 + player.MaxMove, 10), Color.White);

            // block bar

            if (player.BlockHeldTime == 0)
            {
                spriteBatch.Draw(debugs[2], new Rectangle(15 + player.MaxMove, 30, 300, 16), Color.White);
            }
            else
            {
                spriteBatch.Draw(debugs[2], new Rectangle(15 + player.MaxMove, 30, (300 - (player.BlockHeldTime * 3)), 16), Color.White);
            }

            spriteBatch.Draw(healthBar, new Vector2(15 + player.MaxMove, 30), Color.White);


            spriteBatch.DrawString(mainFont, "Level: " + Character.level, new Vector2(player.MaxMove + 505 + screenMiddle, 10), Color.Black);
            if (heart != null)
            {
                heart.Draw(spriteBatch);
            }
        }