Appendix

Other Drawing methods:

Ellipse

Draws an ellipse (oval) on the screen. It is as if it draws the rectangle and then makes the curved Ellipse shape inside of it.


Form: pygame.draw.ellipse(screen, colour, vertices, width)


Variables:

Screen - the created screen where we are drawing the ellipse Color - RGB colour, can be predefined like RED in the example or defined in the statement as (red, green, blue) e.g. (100, 200, 155) Vertices - (x1, y1, w, h) where x1, y1 are the coordinates of the top left and w, h are the width and height of the rectangle in which the ellipse would fit within. Width - optional, does not have to be there, will fill in the ellipse if it is not. If it is, then width represents the thickness of the outside of the ellipse.


Examples:

pygame.draw.ellipse(screen, (255, 0, 0), (120,330, 200, 500)) pygame.draw.ellipse(screen, RED, (0,0, 200,500), 2)

Line

Draws a line on the screen


Form: pygame.draw.line(screen, colour, startCoordinates, endCoordinates, width)


Variables:

Screen - the created screen where we are drawing the line