diff --git a/levels.py b/levels.py index 50d3083..2334c55 100644 --- a/levels.py +++ b/levels.py @@ -112,6 +112,7 @@ def level2(blip, screen, sheet, screen_width, screen_height, lastclickpos, basic screen.blit(dialog_square, (56, 500)) if dialognum == 13: DIALOGTEXT = "" + tickd = 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)) level = 3 @@ -132,4 +133,37 @@ def level2(blip, screen, sheet, screen_width, screen_height, lastclickpos, basic if dialognum != 7: pygame.mixer.Sound.play(blip) tickd = 60 - return level # returns the current level set \ No newline at end of file + 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(" to move around", True, transparency) + dialog3 = basicfont.render(" to interact when prompted", True, transparency) + dialog4 = basicfont.render(" to hide yourself (the parasite)", True, transparency) + dialog5 = basicfont.render(" to pause", True, transparency) + dialog6 = basicfont.render("Press 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 \ No newline at end of file diff --git a/main.py b/main.py index 3a949ea..05634e0 100644 --- a/main.py +++ b/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