generated from dvorakmortonxd/pygame-template
still feel like im cooked, theres 9 hours left for the jam and its 9PM 🥀
This commit is contained in:
parent
f7894f2040
commit
8aa6154710
2 changed files with 48 additions and 8 deletions
20
main.py
20
main.py
|
|
@ -33,8 +33,14 @@ def main(fps=window_fps): # the main function
|
|||
if event.type == pygame.QUIT: # what happens when you click the X button on the window
|
||||
running = False # poof
|
||||
if event.type == pygame.KEYDOWN: # what happens when you press down a key
|
||||
if event.key == pygame.K_ESCAPE:
|
||||
levels.dialognum += 1
|
||||
if event.key == pygame.K_SLASH:
|
||||
levels.dialognum = 13
|
||||
pygame.mixer.music.stop()
|
||||
level = 2
|
||||
if event.key == pygame.K_SPACE:
|
||||
if level == 3:
|
||||
tickd = 0
|
||||
level = 4
|
||||
if event.key == pygame.K_h:
|
||||
if levels.dialognum == 9:
|
||||
levels.tickd = 0
|
||||
|
|
@ -55,12 +61,12 @@ def main(fps=window_fps): # the main function
|
|||
level = levels.level1(screen, sheet, screen_width, screen_height, lastclickpos, basicfont, pygame.mouse, click, bigfont, level, tick, slightly_smaller_than_bigfont, pygame.mixer.music) # runs the level1 function from levels.py
|
||||
if level == 2:
|
||||
level = levels.level2(blip, screen, sheet, screen_width, screen_height, lastclickpos, basicfont, pygame.mouse, click, bigfont, level, tick, slightly_smaller_than_bigfont, pygame.mixer.music)
|
||||
# THE REASON WE CALL IT LIKE THIS INSTEAD OF NORMALLY IS SO WE CAN CHANGE THE LEVEL VARIABLE
|
||||
|
||||
elif level == 2: # what happens when the level variable is equal to 2 ofc
|
||||
level = levels.level2(screen, sheet, lastclickpos, basicfont, pygame.mouse, click, level) # runs the level2 function from levels.py
|
||||
if level == 3:
|
||||
level = levels.level3(blip, screen, sheet, screen_width, screen_height, lastclickpos, basicfont, pygame.mouse, click, bigfont, level, tick, slightly_smaller_than_bigfont, pygame.mixer.music)
|
||||
if level == 4:
|
||||
level = levels.level4(blip, screen, sheet, screen_width, screen_height, lastclickpos, basicfont, pygame.mouse, click, bigfont, level, tick, slightly_smaller_than_bigfont, pygame.mixer.music)
|
||||
fps_text = sysfont.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
|
||||
#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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue