2026-08-26 16:35:06 +00:00
|
|
|
# Example file showing a basic pygame "game loop"
|
|
|
|
|
import pygame
|
|
|
|
|
|
|
|
|
|
# pygame setup
|
|
|
|
|
pygame.init()
|
|
|
|
|
screen = pygame.display.set_mode((1280, 720))
|
|
|
|
|
clock = pygame.time.Clock()
|
|
|
|
|
running = True
|
|
|
|
|
|
|
|
|
|
while running:
|
|
|
|
|
# poll for events
|
|
|
|
|
# pygame.QUIT event means the user clicked X to close your window
|
|
|
|
|
for event in pygame.event.get():
|
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
|
running = False
|
|
|
|
|
|
|
|
|
|
# fill the screen with a color to wipe away anything from last frame
|
|
|
|
|
screen.fill("purple")
|
|
|
|
|
|
|
|
|
|
# RENDER YOUR GAME HERE
|
2026-08-28 16:46:44 +00:00
|
|
|
jays_vector = pygame.Vector2(100, 100)
|
|
|
|
|
jays_anderer_vector = pygame.Vector2(600, 300)
|
|
|
|
|
pygame.draw.line(screen, (0, 0, 0), (0, 0), jays_vector)
|
|
|
|
|
pygame.draw.line(screen, (0, 0, 0), (0, 0), jays_anderer_vector)
|
|
|
|
|
|
|
|
|
|
pygame.draw.line(screen, (255, 255, 255), jays_vector, jays_anderer_vector)
|
|
|
|
|
|
2026-08-26 16:35:06 +00:00
|
|
|
|
|
|
|
|
# flip() the display to put your work on screen
|
|
|
|
|
pygame.display.flip()
|
|
|
|
|
|
|
|
|
|
clock.tick(60) # limits FPS to 60
|
|
|
|
|
|
|
|
|
|
pygame.quit()
|