This commit is contained in:
Martin Dvořák 2026-05-31 23:12:55 +02:00
commit 008b4811a0
3 changed files with 80 additions and 18 deletions

View file

@ -30,7 +30,7 @@ def main(fps=window_fps): # the main function
if event.key == pygame.K_ESCAPE: # what happens when you press escape
running = False # poof
if event.key == pygame.K_k:
level = 4.5
level = 6
if event.type == pygame.MOUSEBUTTONDOWN: # what happens when you press down a mouse button
click = True # sets the click variable to True so level function in levels.py can see
print(pygame.mouse.get_pos()) # prints out where the mouse is during the click for debugging purposes
@ -61,8 +61,12 @@ def main(fps=window_fps): # the main function
elif level == 5:
tick += 1
level = levels.level5(screen, sheet, screen_width, screen_height, lastclickpos, basicfont, pygame.mouse, click, bigtext, level, tick, smalltext) # runs the level5 function from levels.py
elif level == 6:
tick += 1
level = levels.level6(screen, sheet, screen_width, screen_height, lastclickpos, basicfont, pygame.mouse, click, bigtext, level, tick, smalltext) # runs the level5 function from levels.py
fps_text = smalltext.render(str(int(clock.get_fps())), True, (0, 255, 0)) # defines a thing that renders your fps in the top left corner
screen.blit(fps_text, (5, 5)) # this actually renders "ftp_text" on the screen at the position (5, 5) which is the top left corner
if level != 6:
screen.blit(fps_text, (5, 5)) # this actually renders "ftp_text" on the screen at the position (5, 5) which is the top left corner
pygame.display.flip() # this updates the display so it displays all the new stuff we added
clock.tick(fps) # this makes sure the game loop runs at the fps we set it to before
pygame.quit() #this quits our game when the game loop somehow ends, for example by pressing escape or the X button on the window