/// <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); spriteBatch.Begin(); levelHandler.DrawLevel(this.spriteBatch); player.Draw(this.spriteBatch); lava.Draw(this.spriteBatch); if (currentGameState == GameState.StartMenu) { spriteBatch.DrawString(font10, "PRESS SPACE TO START", new Vector2(85, 400), Color.Black); } else if (currentGameState == GameState.LevelCompleted) { spriteBatch.DrawString(font10, "PRESS SPACE FOR NEXT LEVEL", new Vector2(50, 400), Color.Black); } else if (currentGameState == GameState.LevelFailed) { spriteBatch.DrawString(font10, "PRESS SPACE TO TRY AGAIN", new Vector2(60, 400), Color.Black); } else if (currentGameState == GameState.Completed) { spriteBatch.DrawString(font10, "YOU'RE VICTORIOUS!", new Vector2(85, 400), Color.Black); } spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); levelHandler.DrawLevel(this.spriteBatch); player.Draw(this.spriteBatch); lava.Draw(this.spriteBatch); if (currentGameState == GameState.StartMenu) { spriteBatch.DrawString(font30, "TAP TO START", new Vector2((480 - font30.MeasureString("TAP TO START").X) / 2, 400), Color.Black); } else if (currentGameState == GameState.LevelCompleted) { spriteBatch.DrawString(font20, "TAP FOR NEXT LEVEL", new Vector2((480 - font20.MeasureString("TAP FOR NEXT LEVEL").X) / 2, 400), Color.Black); } else if (currentGameState == GameState.LevelFailed) { spriteBatch.DrawString(font20, "TAP TO TRY AGAIN", new Vector2((480 - font20.MeasureString("TAP TO TRY AGAIN").X) / 2, 400), Color.Black); } else if (currentGameState == GameState.Completed) { spriteBatch.DrawString(font20, "YOU'RE VICTORIOUS!", new Vector2((480 - font20.MeasureString("YOU'RE VICTORIOUS!").X) / 2, 400), Color.Black); } if (showBestTime) { string text = "WORLD RECORD IS: " + bestTime; spriteBatch.DrawString(font20, text, new Vector2((480 - font20.MeasureString(text).X) / 2, 25), Color.Black); } if (showPersonalBestTimeText) { string text = "YOUR BEST TIME IS: " + float.Parse(personalBest).ToString("0.00", cultureInfo); spriteBatch.DrawString(font10, text, new Vector2(80, 455), Color.Black); } else if (showNewRecordText) { string text = "YOU SET A NEW RECORD! " + totalTime.ToString("0.00", cultureInfo); spriteBatch.DrawString(font10, text, new Vector2(50, 455), Color.Black); } spriteBatch.DrawString(font10, "Elapsed time: " + totalTime.ToString("0.00", cultureInfo), new Vector2(15, 770), Color.Black); spriteBatch.End(); base.Draw(gameTime); }