コード例 #1
0
 public void render(GameTime gameTime, SpriteBatch batch)
 {
     background.render(batch);
     player.render(batch);
     playButton.render(batch);
     exitButton.render(batch);
 }
コード例 #2
0
        public void render(GameTime gameTime, SpriteBatch batch)
        {
            if (initialized)
            {
                background.render(batch);
                platform.render(batch);
                platform1.render(batch);
                platform2.render(batch);
                platform3.render(batch);
                platform4.render(batch);
                platform5.render(batch);
                player.render(batch);
                nextButton.render(batch);

                if (player.health <= 100 && player.health > 0)
                {
                    hpHearth.render(batch);
                }
                if (player.health <= 200 && player.health > 100)
                {
                    hpHearth.render(batch);
                    hpHearth1.render(batch);
                }
                if (player.health <= 300 && player.health > 200)
                {
                    hpHearth.render(batch);
                    hpHearth1.render(batch);
                    hpHearth2.render(batch);
                }
                if (player.health <= 400 && player.health > 300)
                {
                    hpHearth.render(batch);
                    hpHearth1.render(batch);
                    hpHearth2.render(batch);
                    hpHearth3.render(batch);
                }
                if (player.health <= 500 && player.health > 400)
                {
                    hpHearth.render(batch);
                    hpHearth1.render(batch);
                    hpHearth2.render(batch);
                    hpHearth3.render(batch);
                    hpHearth4.render(batch);
                }

                batch.DrawString(Loading.mainFont, "" + GameStage.score, new Vector2(700, 2), Color.White);
                batch.DrawString(Loading.mainFont, "HEALTH: " + player.health, new Vector2(120, 2), Color.White);

                for (int i = 0; i < enemies.Count; i++)
                {
                    enemies[i].render(batch);
                }
            }
        }