Drawing different shapes and using the color black

Mentors' note:

Here you can show ninjas that rectangles are not the only shape, (you don't have to go into all the shapes available in PyGame because drawing rectangles and images is enough to create our Pacman game)

The important part is to make them use black shapes to erase other shapes as this is the method used in PyGame (and other Canvas-type frameworks) to reproduce an "erase" effect

We can draw all kinds of shapes! here is an example of a circle and a line:

pygame.draw.circle(DISPLAY, Color('yellow'), [150,150], 100)

pygame.draw.line(DISPLAY, Color('white'), [150, 270], [280, 270], 1)

  • [ ] Draw the circle in the center of the screen, on top of your rectangle but smaller than the rectangle
  • [ ] Now change the circle's color to black, this should give you the impression that you made a hole in your rectangle! That's how we "erase" in PyGame, we draw in black on top of existing drawings

results matching ""

    No results matching ""