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
36
levels.py
36
levels.py
|
|
@ -112,6 +112,7 @@ def level2(blip, screen, sheet, screen_width, screen_height, lastclickpos, basic
|
||||||
screen.blit(dialog_square, (56, 500))
|
screen.blit(dialog_square, (56, 500))
|
||||||
if dialognum == 13:
|
if dialognum == 13:
|
||||||
DIALOGTEXT = ""
|
DIALOGTEXT = ""
|
||||||
|
tickd = 0
|
||||||
screen.blit(load_sprite(sheet, 0, 37, 57,36, 912, 576), (0,0))
|
screen.blit(load_sprite(sheet, 0, 37, 57,36, 912, 576), (0,0))
|
||||||
screen.blit(load_sprite(sheet,57,15,8,25, 80, 250), (660, 290))
|
screen.blit(load_sprite(sheet,57,15,8,25, 80, 250), (660, 290))
|
||||||
level = 3
|
level = 3
|
||||||
|
|
@ -132,4 +133,37 @@ def level2(blip, screen, sheet, screen_width, screen_height, lastclickpos, basic
|
||||||
if dialognum != 7:
|
if dialognum != 7:
|
||||||
pygame.mixer.Sound.play(blip)
|
pygame.mixer.Sound.play(blip)
|
||||||
tickd = 60
|
tickd = 60
|
||||||
return level # returns the current level set
|
return level # returns the current level set
|
||||||
|
|
||||||
|
def level3(blip, screen, sheet, screen_width, screen_height, lastclickpos, basicfont, mouse, click, big_text, level, tick, slightfont, pygamemixer): # the function for our first level, ignore the unused variables here, you can use them when you edit it
|
||||||
|
global tickd
|
||||||
|
tickd += 1
|
||||||
|
screen.blit(load_sprite(sheet, 0, 37, 57, 36, 912, 576), (0, 0))
|
||||||
|
screen.blit(load_sprite(sheet,57,15,8,25, 80, 250), (660, 290))
|
||||||
|
square = pygame.surface.Surface((812, 476), pygame.SRCALPHA)
|
||||||
|
square.fill((0, 0, 0))
|
||||||
|
if tickd < 255:
|
||||||
|
transparency = (tickd, tickd, tickd)
|
||||||
|
else:
|
||||||
|
transparency = (255,255,255)
|
||||||
|
dialog1 = basicfont.render("Controls:", True, transparency)
|
||||||
|
dialog2 = basicfont.render("<WASD> to move around", True, transparency)
|
||||||
|
dialog3 = basicfont.render("<E> to interact when prompted", True, transparency)
|
||||||
|
dialog4 = basicfont.render("<H> to hide yourself (the parasite)", True, transparency)
|
||||||
|
dialog5 = basicfont.render("<Escape> to pause", True, transparency)
|
||||||
|
dialog6 = basicfont.render("Press <Space> to continue.", True, transparency)
|
||||||
|
square.blit(dialog1, (15, 15))
|
||||||
|
square.blit(dialog2, (15, 65))
|
||||||
|
square.blit(dialog3, (15, 115))
|
||||||
|
square.blit(dialog4, (15, 165))
|
||||||
|
square.blit(dialog5, (15, 215))
|
||||||
|
square.blit(dialog6, (15, 426))
|
||||||
|
screen.blit(square, (50, 50))
|
||||||
|
return level
|
||||||
|
|
||||||
|
def level4(blip, screen, sheet, screen_width, screen_height, lastclickpos, basicfont, mouse, click, big_text, level, tick, slightfont, pygamemixer): # the function for our first level, ignore the unused variables here, you can use them when you edit it
|
||||||
|
global tickd
|
||||||
|
tickd += 1
|
||||||
|
screen.blit(load_sprite(sheet, 0, 37, 57, 36, 912, 576), (0, 0))
|
||||||
|
screen.blit(load_sprite(sheet,57,15,8,25, 80, 250), (660, 290))
|
||||||
|
return level
|
||||||
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
|
if event.type == pygame.QUIT: # what happens when you click the X button on the window
|
||||||
running = False # poof
|
running = False # poof
|
||||||
if event.type == pygame.KEYDOWN: # what happens when you press down a key
|
if event.type == pygame.KEYDOWN: # what happens when you press down a key
|
||||||
if event.key == pygame.K_ESCAPE:
|
if event.key == pygame.K_SLASH:
|
||||||
levels.dialognum += 1
|
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 event.key == pygame.K_h:
|
||||||
if levels.dialognum == 9:
|
if levels.dialognum == 9:
|
||||||
levels.tickd = 0
|
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
|
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:
|
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)
|
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
|
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)
|
||||||
elif level == 2: # what happens when the level variable is equal to 2 ofc
|
if level == 4:
|
||||||
level = levels.level2(screen, sheet, lastclickpos, basicfont, pygame.mouse, click, level) # runs the level2 function from levels.py
|
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
|
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
|
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
|
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
|
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