You are going to screenshot all of your work into a Powerpoint file.
To save your powerpoint go to:
Save the Powerpoint file: as your name
# pygame template - LearnItWithMrC import pygame # accesses pygame files import sys # to communicate with windows # game setup ################ only runs once pygame.init() # starts the game engine clock = pygame.time.Clock() # creates clock to limit frames per second FPS = 60 # sets max speed of main loop SCREENWIDTH = 640 # sets the width of the screen/window SCREENHEIGHT = 480 # sets the height of the screen/window # creates window and game screen with twin value screen = pygame.display.set_mode((SCREENWIDTH ,SCREENHEIGHT)) # set variables for colors RGB (0-255) white = (255, 255, 255) black = (0, 0, 0) red = (255, 0, 0) yellow = (255, 255, 0) green = (0, 255, 0) ####################### Your Variables go below here ################# ####################################################################### # game loop #################### runs 60 times a second! while True: # game loop - note: everything in the mainloop is indented one tab for event in pygame.event.get(): # get user interaction events if event.type == pygame.QUIT: # tests if window's X (close) has been clicked pygame.quit() # stops the game engine sys.exit() # close operating system window # your code starts here ############################## # your code ends here ############################### pygame.display.flip() # updates the entire screen clock.tick(FPS) # limits game to frame per second, FPS value # out of game loop ###############
This is the function we need to use in pygame to draw a line:
So lets fill it in with the co-ordinates we mentioned above (0,0)and (30,40) and we will use the colour green and a line thickness of 2
Look at the image below to see where to put this line of code in your template. hint: it goes between the lines that say 'your code starts here' and 'your code ends here'.
In order to draw a rectangle we only need the co-ordinates for the top left hand corner of the rectangle and then the height and width in pixels.
When you run your code it should look like this:
Lets look at the learning outcomes and decide which one best describes our current level of understanding :
Tick the one you feel is closest to your level