fff.py

Created by astieralban07

Created on October 20, 2023

1.12 KB

ff


# The loop will carry on until the user exits the game (e.g. clicks the close button).
carryOn = True
# The clock will be used to control how fast the screen updates
clock = pygame.time.Clock()
# -------- Main Program Loop -----------
while carryOn:
    # --- Main event loop
    for event in pygame.event.get(): # User did something
        if event.type == pygame.QUIT: # If user clicked close
              carryOn = False # Flag that we are done so we can exit the while loop
     # --- Game logic should go here
     # --- Drawing code should go here
     # First, clear the screen to white. 
     screen.fill(WHITE)
     #The you can draw different shapes and lines or add text to your background stage.
     pygame.draw.rect(screen, RED, [55, 200, 100, 70],0)
     pygame.draw.line(screen, GREEN, [0, 0], [100, 100], 5)
     pygame.draw.ellipse(screen, BLACK, [20,20,250,100], 2)
     # --- Go ahead and update the screen with what we've drawn.
     pygame.display.flip()
     
     # --- Limit to 60 frames per second
     clock.tick(60)
#Once we have exited the main program loop we can stop the game engine:
pygame.quit()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.