//Drawing event. Малювання об'єктів private void boardPB_Paint(object sender, PaintEventArgs e) { //e.Graphics.InterpolationMode = InterpolationMode.High; items.Draw(e.Graphics); pacman.Draw(e.Graphics); blinky.Draw(e.Graphics); pinky.Draw(e.Graphics); inky.Draw(e.Graphics); clyde.Draw(e.Graphics); }
public override void Draw(SpriteBatch spriteBatch) { pac.Draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(); for (int i = 0; i <= Graphics.Viewport.Width / pac.Texture.Width; i++) { spriteBatch.Draw(pixel, new Rectangle(i * 40, 0, 1, Graphics.Viewport.Height), Color.White); spriteBatch.Draw(pixel, new Rectangle(0, i * 40, Graphics.Viewport.Width, 1), Color.White); } foreach (var fud in food) { fud.Draw(spriteBatch); } foreach (var wall in Walls) { wall.Draw(spriteBatch); } foreach (var heart in Hearts) { heart.Draw(spriteBatch); } foreach (var power in PowerUps) { power.Draw(spriteBatch); } blinky.Draw(spriteBatch); pinky.Draw(spriteBatch); Clyde.Draw(spriteBatch); Inky.Draw(spriteBatch); if (pac.IsPowerActivated) { if (pac.elapsedPowerTime >= pac.PowerTime - TimeSpan.FromSeconds(2)) { spriteBatch.Draw(pixel, new Rectangle(0, 0, Graphics.Viewport.Width, Graphics.Viewport.Height), Color.Red * 0.5f); } else { spriteBatch.Draw(pixel, new Rectangle(0, 0, Graphics.Viewport.Width, Graphics.Viewport.Height), Color.Gray * 0.5f); } } base.Draw(spriteBatch); }