summaryrefslogtreecommitdiffstats
path: root/Jumper-main/Day 1/main.py
blob: 5362c9e5ed62d63f38bbc555a45c0434c1e231ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from setup import *
from jumper import Jumper

is_running = True

dimensions = (SCREEN_WIDTH, SCREEN_HEIGHT)
screen = pygame.display.set_mode(dimensions)

# Set the window title to Jumper
pygame.display.set_caption("Jumper")

# This is what will handle game logic and drawing
game = Jumper()

# Main game loop
while is_running:
	# Draw white background
	screen.fill((255, 255, 255))

	# Update game logic and draw
	game.update()
	game.draw(screen)  

	# Loop over all pending events and clear them
	for event in pygame.event.get():
		# If there is a quit event, the user wants to exit
		# This will make the close (red X) button work
		if event.type == pygame.QUIT:
			is_running = False

	# Update the display with the latest frame...
	# This is used so that everything is displayed to the user in one step, after all instructions 
	# are completed. Pygame does not immediately display drawn objects, as otherwise the user would
	# see them flicker out (as the screen is filled) and in (as the object is drawn). This update
	# will replace the previous frame.
	pygame.display.update()

pygame.quit()