protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); sky.Draw(spriteBatch); ocean.Draw(spriteBatch); dolphin.Draw(spriteBatch); //spriteBatch.Draw(Content.Load<Texture2D>("clever1"), new Rectangle(100, 100, 120, 60), new Rectangle(0, 0, 1000, 600), Color.White); /* * if (delay == 300) * { * Console.WriteLine("lalala");*/ foreach (Sprite sp in listCoin) { sp.Draw(spriteBatch); Console.WriteLine("gambar coin"); } //} spriteBatch.DrawString(score, sc.ToString(), font1, Color.Black); spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); switch (CurrentGameState) { case GameState.MainMenu: spriteBatch.Draw(Content.Load <Texture2D>("halamanDepan"), new Rectangle(0, 0, windowWidth, windowHeight), Color.White); btnPlay.Draw(spriteBatch); btnExit2.Draw(spriteBatch); break; case GameState.Playing: sky.Draw(spriteBatch); ocean.Draw(spriteBatch); dolphin.Draw(spriteBatch); //menampilkan list Bubble foreach (Sprite sp in _3pilihan.listBubble) { sp.Draw(spriteBatch); } foreach (Sprite rp in listCumi) { rp.Draw(spriteBatch); } foreach (Sprite smp in listKaleng) { smp.Draw(spriteBatch); } //menampilkan font score Bubble spriteBatch.DrawString(score, tempScore.ToString(), fontScore, Color.Black); spriteBatch.DrawString(score, displayRating, fontHighScore, Color.Black); spriteBatch.DrawString(score, text3.ToString(), fontHighScore2, Color.Black); // spriteBatch.DrawString(score, staminaValue.ToString(), staminaBar, Color.Yellow); spriteBatch.DrawString(number, initialNumber.ToString(), fontNumber, Color.White); spriteBatch.Draw(staminaPict, new Rectangle(50, 2, 190, 47), Color.White); spriteBatch.Draw(highScorePict, new Rectangle(740, 0, 250, 52), Color.White); spriteBatch.Draw(ScorePict, new Rectangle(1000, 0, 250, 52), Color.White); staminaGauge.Draw(spriteBatch); break; case GameState.GameOver: //GraphicsDevice.Reset(); spriteBatch.Draw(Content.Load <Texture2D>("halamanDepan"), new Rectangle(0, 0, windowWidth, windowHeight), Color.White); btnPlayAgain.Draw(spriteBatch); btnExit.Draw(spriteBatch); break; default: break; } spriteBatch.End(); base.Draw(gameTime); }