コード例 #1
0
ファイル: GameLevel.cs プロジェクト: mathiassamyn/UnfairMario
        public void Draw()
        {
            hero.Draw();
            for (int i = 0; i < map.Hoogte; i++)
            {
                for (int j = 0; j < map.Breedte; j++)
                {
                    if (spriteArray[j, i] != null)
                    {
                        spriteArray[j, i].Draw();
                    }
                }
            }
            for (int i = 0; i < rocketList.Count; i++)
            {
                rocketList[i].Draw();
            }
            video.Blit(coinCountSurface, new Point(video.Width - coinCountSurface.Width, 0));
            video.Blit(coinSingle, new Point(video.Width - coinCountSurface.Width - coinSingle.Width - 10, 0));
            if (hero.dead)
            {
                endText("You are dead", "Try again");
            }

            if (hero.win)
            {
                string menuOption = "Next level";
                if (level == 2)
                {
                    menuOption = "Menu";
                }
                endText("You win", menuOption);
            }
        }
コード例 #2
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();
            if (hero.HP > 0)
            {
                if (bonuses.BonusCount > 0)
                {
                    gameLand.Draw();

                    bonuses.Draw();

                    enemys.Draw();

                    hero.Draw(spriteBatch);
                }
                else
                {
                    userInterface.EndGame(Content, gameLand.W * 30, gameLand.H * 30, true);
                    GraphicsDevice.Clear(Color.FromNonPremultiplied(39, 174, 96, 1));
                }
            }
            else
            {
                userInterface.EndGame(Content, gameLand.W * 30, gameLand.H * 30, false);
                GraphicsDevice.Clear(Color.FromNonPremultiplied(39, 174, 96, 1));
            }

            userInterface.Draw(bonuses.BonusCount, hero.HP, hero.Armor, height, width);

            spriteBatch.End();

            base.Draw(gameTime);
        }