private void GameLoop(object sender, EventArgs e) { paddle.Move(); ball.Move(); ball.Draw(); paddle.Draw(); DrawAndMoveBonuses(); }
/// <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); paddle.Draw(); // TODO: Add your drawing code here wall.Draw(); ball.Draw(); base.Draw(gameTime); }
public override void Draw(Graphics g) { g.DrawImage(this.background, new Point(0, 0)); player.Draw(g); ball.Draw(g); blockManager.Draw(g); score.Draw(g, "Score:"); highScore.Draw(g, "HighScore:"); }
public void Draw(SpriteBatch spriteBatch) { if (visible) { spriteBatch.Draw(Rect, new Rectangle(game.X0, game.Y0, game.Width, game.Height), Color.White); paddle.Draw(spriteBatch); ball.Draw(spriteBatch); level.Draw(spriteBatch); } }
/// <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.Black); // TODO: Add your drawing code here spriteBatch.Begin(); paddle.Draw(); wall.Draw(); gameBorder.Draw(); if (ball.Visible) { bool inPlay = ball.Move(wall, paddle); if (inPlay) { ball.Draw(); } else { ballsRemaining--; readyToServeBall = true; } } staticBall.Draw(); string scoreMsg = "Score: " + ball.Score.ToString("00000"); Vector2 space = gameContent.labelFont.MeasureString(scoreMsg); spriteBatch.DrawString(gameContent.labelFont, scoreMsg, new Vector2((screenWidth - space.X) / 2, screenHeight - 40), Color.White); if (ball.bricksCleared >= 70) { ball.Visible = false; ball.bricksCleared = 0; wall = new Wall(1, 50, spriteBatch, gameContent); readyToServeBall = true; } if (readyToServeBall) { if (ballsRemaining > 0) { string startMsg = "Press <Space> or Click Mouse to Start"; Vector2 startSpace = gameContent.labelFont.MeasureString(startMsg); spriteBatch.DrawString(gameContent.labelFont, startMsg, new Vector2((screenWidth - startSpace.X) / 2, screenHeight / 2), Color.White); } else { string endMsg = "Game Over"; Vector2 endSpace = gameContent.labelFont.MeasureString(endMsg); spriteBatch.DrawString(gameContent.labelFont, endMsg, new Vector2((screenWidth - endSpace.X) / 2, screenHeight / 2), Color.White); } } spriteBatch.DrawString(gameContent.labelFont, ballsRemaining.ToString(), new Vector2(40, 10), 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); //Draw Background spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.Opaque, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone); spriteBatch.Draw(gameBackground, GameArea, backgroundRectangle, Color.White); spriteBatch.End(); //Other stuff spriteBatch.Begin(); Player.Draw(spriteBatch); Cells.Draw(spriteBatch); Ball.Draw(spriteBatch); hud.Draw(spriteBatch); spriteBatch.End(); base.Draw(gameTime); }