import pygame from render import load_sprite # this makes it so our function for rendering sprites from sprites.png is available in here milk_pos_x, milk_pos_y = 274, 342 holding_milk = False def level1(screen, sheet, screen_width, screen_height, lastclickpos, basicfont, mouse, click, big_text, level, tick): # the function for our first level, ignore the unused variables here, you can use them when you edit it screen.blit(load_sprite(sheet, 0, 0, 48, 36, screen_width, screen_height), (0, 0)) # this renders a button I made in the sprites.png, its purely for visual purposes so it doesnt matter where you click rn mainmenu_text = big_text.render("Revival Inc.", True, (0, 0, 0)) playb_collision = pygame.Rect(250, 250, 253, 110) exitb_collision = pygame.Rect(250, 400, 253, 110) if playb_collision.collidepoint(mouse.get_pos()): screen.blit(load_sprite(sheet, 24, 36, 23, 10, 253, 110), (250, 250)) play_text = basicfont.render("Play", True, (255,255,255)) if click: level = 2 else: screen.blit(load_sprite(sheet, 0, 36, 23, 10, 253, 110), (250, 250)) play_text = basicfont.render("Play", True, (0,0,0)) screen.blit(play_text, (300, 260)) if exitb_collision.collidepoint(mouse.get_pos()): screen.blit(load_sprite(sheet, 24, 36, 23, 10, 253, 110), (250, 400)) exit_text = basicfont.render("Exit", True, (255,255,255)) if click: level = 0 else: screen.blit(load_sprite(sheet, 0, 36, 23, 10, 253, 110), (250, 400)) exit_text = basicfont.render("Exit", True, (0,0,0)) screen.blit(exit_text, (300, 410)) screen.blit(mainmenu_text, (195, 35)) return level # this returns the change we made to the level so that it updates in main.py def level2(screen, sheet, screen_width, screen_height, lastclickpos, basicfont, mouse, click, big_text, level, tick, smalltext): # function for level 2 screen.blit(load_sprite(sheet, 0, 46, 48, 36, screen_width, screen_height), (0,0)) screen.blit(load_sprite(sheet, 8, 82, 12, 12, 96, 96) , (645, 214)) # ZOMBIE screen.blit(load_sprite(sheet, 20, 82, 7, 12, 49,74), (274, 342)) # MILK CARTON dialog_square = pygame.surface.Surface((700, 68), pygame.SRCALPHA) dialog_square.fill((0, 0, 0)) if 60 <= tick <= 400: if tick < 186: dialog = basicfont.render("Hey...", True, (0+tick*2-120, 0+tick*2-120, 0+tick*2-120)) else: dialog = basicfont.render("Hey...", True, (255, 255, 255)) dialog_square.blit(load_sprite(sheet, 0, 82, 8, 8, 48, 48), (15, 10)) dialog_square.blit(dialog, (78, 15)) screen.blit(dialog_square, (34, 500)) elif 401 <= tick <= 750: if tick < 525: dialog = smalltext.render("ur probably wondering where u are.", True, (0+(tick-401)*2, 0+(tick-401)*2, 0+(tick-401)*2)) else: dialog = smalltext.render("ur probably wondering where u are.", True, (255, 255, 255)) dialog_square.blit(load_sprite(sheet, 0, 82, 8, 8, 48, 48), (15, 10)) dialog_square.blit(dialog, (78, 15)) screen.blit(dialog_square, (34, 500)) elif 751 <= tick <= 1000: if tick < 876: dialog = smalltext.render("you are inside the dungeons.", True, (0+(tick-751)*2, 0+(tick-751)*2, 0+(tick-751)*2)) else: dialog = smalltext.render("you are inside the dungeons.", True, (255, 255, 255)) dialog_square.blit(load_sprite(sheet, 0, 82, 8, 8, 48, 48), (15, 10)) dialog_square.blit(dialog, (78, 15)) screen.blit(dialog_square, (34, 500)) elif 1001 <= tick <= 1300: if tick < 1126: dialog = smalltext.render("see that milk?", True, (0+(tick-1001)*2, 0+(tick-1001)*2, 0+(tick-1001)*2)) else: dialog = smalltext.render("see that milk?", True, (255, 255, 255)) dialog_square.blit(load_sprite(sheet, 0, 82, 8, 8, 48, 48), (15, 10)) dialog_square.blit(dialog, (78, 15)) screen.blit(dialog_square, (34, 500)) elif 1301 <= tick <= 1600: if tick < 1426: dialog = smalltext.render("no its not for drinking", True, (0+(tick-1301)*2, 0+(tick-1301)*2, 0+(tick-1301)*2)) else: dialog = smalltext.render("no its not for drinking", True, (255, 255, 255)) dialog_square.blit(load_sprite(sheet, 0, 82, 8, 8, 48, 48), (15, 10)) dialog_square.blit(dialog, (78, 15)) screen.blit(dialog_square, (34, 500)) elif 1601 <= tick <= 1900: if tick < 1626: dialog = smalltext.render("see that dead zombie?", True, (0+(tick-1601)*2, 0+(tick-1601)*2, 0+(tick-1601)*2)) else: dialog = smalltext.render("see that dead zombie?", True, (255, 255, 255)) dialog_square.blit(load_sprite(sheet, 0, 82, 8, 8, 48, 48), (15, 10)) dialog_square.blit(dialog, (78, 15)) screen.blit(dialog_square, (34, 500)) elif 1901 <= tick <= 2200: if tick < 2026: dialog = smalltext.render("well guess what", True, (0+(tick-1901)*2, 0+(tick-1901)*2, 0+(tick-1901)*2)) else: dialog = smalltext.render("well guess what", True, (255, 255, 255)) dialog_square.blit(load_sprite(sheet, 0, 82, 8, 8, 48, 48), (15, 10)) dialog_square.blit(dialog, (78, 15)) screen.blit(dialog_square, (34, 500)) elif 2201 <= tick <= 2500: if tick < 2326: dialog = smalltext.render("try dragging the milk to him", True, (0+(tick-2201)*2, 0+(tick-2201)*2, 0+(tick-2201)*2)) else: dialog = smalltext.render("try dragging the milk to him", True, (255, 255, 255)) dialog_square.blit(load_sprite(sheet, 0, 82, 8, 8, 48, 48), (15, 10)) dialog_square.blit(dialog, (78, 15)) screen.blit(dialog_square, (34, 500)) elif tick >= 2501: level = 2.5 return level # returns the current level set def level3(screen, sheet, screen_width, screen_height, lastclickpos, basicfont, mouse, click, big_text, level, tick, smalltext): # function for level 2 global milk_pos_x, milk_pos_y, holding_milk milk_collision = pygame.Rect(milk_pos_x-20, milk_pos_y-50, 49, 74) screen.blit(load_sprite(sheet, 0, 46, 48, 36, screen_width, screen_height), (0, 0)) screen.blit(load_sprite(sheet, 8, 82, 12, 12, 96, 96), (645, 214)) # ZOMBIE msx, msy = pygame.mouse.get_pos() if milk_collision.collidepoint(mouse.get_pos()): if click: holding_milk = True if not click: holding_milk = False if holding_milk: milk_pos_x, milk_pos_y = msx, msy screen.blit(load_sprite(sheet, 20, 82, 7, 12, 49, 74), (milk_pos_x-20, milk_pos_y-50)) # MILK CARTON print(milk_collision) dialog_square = pygame.surface.Surface((700, 68), pygame.SRCALPHA) dialog_square.fill((0, 0, 0)) return level