/// <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); if (gamestate == 1) { spriteBatch.Begin(); spriteBatch.Draw(background, new Rectangle(0, 0, 800, 480), Color.White); spriteBatch.End(); } if (gamestate == 2) { spriteBatch.Begin(); spriteBatch.DrawString(font1, "Score: 0", new Vector2(20, 10), Color.Black); spriteBatch.End(); GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; upperWorld.Draw(world, view, projection); player.Draw(world, view, projection); } if (gamestate == 3) { GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; upperWorld.Draw(world, view, projection); player.Draw(world, view, projection); spriteBatch.Begin(); spriteBatch.Draw(white, new Rectangle(0, 0, 800, whiteDepth), Color.White); spriteBatch.DrawString(font1, "Score: 1", new Vector2(20, 10), Color.Black); if (whiteDepth > 480) { //endScreen spriteBatch.Draw(endScreen, new Rectangle(130, 100, 550, 300), Color.White); } spriteBatch.End(); } base.Draw(gameTime); }
/// <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) { environment.Draw(spriteBatch); scoreBoard.Draw(spriteBatch); spriteBatch.Begin(); foreach (Bouncerang b in bouncerangs) { b.Draw(spriteBatch); } foreach (GameObject p in Projectiles) { if (p is Arrow) { Arrow a = (Arrow)p; a.Draw(spriteBatch); } else if (p is Bomb) { Bomb a = (Bomb)p; a.Draw(spriteBatch); } else if (p is Potion) { Potion a = (Potion)p; a.Draw(spriteBatch); } } foreach (Enemy e in Enemies) { e.Draw(spriteBatch); } link.Draw(spriteBatch); if (isGameOver) { spriteBatch.DrawString(fontBig, "Game Over...", new Vector2(220, 55), Color.White); } else if (showItemText && showItemTextCounter < 100) { spriteBatch.DrawString(fontBig, gotItemText, new Vector2(200, 55), Color.White); showItemTextCounter++; } spriteBatch.End(); if (Paused) { menu.Draw(spriteBatch); } // TODO: Add your drawing code here base.Draw(gameTime); }