/// <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(); // draw game objects burger.Draw(spriteBatch); foreach (TeddyBear bear in bears) { bear.Draw(spriteBatch); } foreach (Projectile projectile in projectiles) { projectile.Draw(spriteBatch); } foreach (Explosion explosion in explosions) { explosion.Draw(spriteBatch); } // draw score and health 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) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); // draw game objects burger.Draw(spriteBatch); foreach (TeddyBear bear in bears) { bear.Draw(spriteBatch); } foreach (Projectile projectile in projectiles) { projectile.Draw(spriteBatch); } foreach (Explosion explosion in explosions) { explosion.Draw(spriteBatch); } // draw score and health spriteBatch.DrawString(font, healthString, GameConstants.HEALTH_LOCATION, Color.White); spriteBatch.DrawString(font, scoreString, GameConstants.SCORE_LOCATION, 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) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); // draw game objects burger.Draw(spriteBatch); //spriteBatch.DrawLine(new Vector2(0, GameConstants.WindowHeight / 2), new Vector2(GameConstants.WindowWidth, GameConstants.WindowHeight / 2), Color.Red,1f); //spriteBatch.DrawLine(new Vector2(GameConstants.WindowWidth / 2, GameConstants.WindowHeight), new Vector2(GameConstants.WindowWidth / 2, 0), Color.Black, 1f); //spriteBatch.DrawLine(new Vector2(GameConstants.WindowWidth / 2, GameConstants.WindowHeight), new Vector2(GameConstants.WindowWidth / 2, 0), Color.Red); //spriteBatch.DrawLine(new Vector2(0, GameConstants.WindowHeight / 2),new Vector2(GameConstants.WindowWidth,GameConstants.WindowHeight/2), Color.Red); foreach (TeddyBear bear in bears) { bear.Draw(spriteBatch); } foreach (Projectile projectile in projectiles) { projectile.Draw(spriteBatch); } foreach (Explosion explosion in explosions) { explosion.Draw(spriteBatch); } // draw score and health spriteBatch.End(); base.Draw(gameTime); }
void DibujarExplosiones(SpriteBatch spriteBatch) { try { foreach (AnimacionElementos explosion in explosiones) { explosion.Draw(spriteBatch); } } catch (Exception) { } }
/// <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.LightSlateGray); spriteBatch.Begin(); // draw game objects if (burger != null) { burger.Draw(spriteBatch); } if (bears.Any()) { foreach (TeddyBear bear in bears) { bear.Draw(spriteBatch); } } foreach (Projectile projectile in projectiles) { projectile.Draw(spriteBatch); } foreach (Explosion explosion in explosions) { explosion.Draw(spriteBatch); } // draw score, health, g/o foreach (Message message in messages) { if (!burgerDead) { message.Draw(spriteBatch, Color.Wheat); } } if (burgerDead) { eventMessage.Draw(spriteBatch, Color.Red); foreach (Message message in messages) { message.Draw(spriteBatch, Color.Beige); } } //alt way //spriteBatch.DrawString(font,scoreString, GameConstants.ScoreLocation, Color.Wheat); 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> // The student will complete this function as part of an activity protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.SkyBlue); spriteBatch.Begin(); // draw the smoke sprayer if (smokeSprayer != null) { smokeSprayer.Draw(spriteBatch); } // draw all active smoke shots foreach (Sprite smokeShot in smokeShots) { smokeShot.Draw(spriteBatch); } // draw all active bee shots foreach (Sprite beeShot in beeShots) { beeShot.Draw(spriteBatch); } // draw all active bees foreach (Sprite bee in bees) { bee.Draw(spriteBatch); } // draw all remaining hive sections foreach (Sprite hiveSection in hiveSections) { hiveSection.Draw(spriteBatch); } if (gameOver == true) { if (Won == true) { spriteBatch.DrawString(gameFont, "You win!!!", new Vector2(20, 20), Color.Black); } if (Won == false) { spriteBatch.DrawString(gameFont, "You lose!!!", new Vector2(20, 20), Color.Black); } spriteBatch.DrawString(gameFont, displayMessage, new Vector2(20, 40), Color.Black); GamePadState CurrentGamePadState = GamePad.GetState(PlayerIndex.One); if (CurrentGamePadState.IsConnected == false) { spriteBatch.DrawString(gameFont, "Press SPACE to try again!", new Vector2(20, 60), Color.Black); } if (CurrentGamePadState.IsConnected == true) { spriteBatch.DrawString(gameFont, "Press A to try again!", new Vector2(20, 60), Color.Black); } } spriteBatch.End(); base.Draw(gameTime); }