generated from dvorakmortonxd/pygame-template
finally can hold the milk carton lmao
This commit is contained in:
parent
7151183ea5
commit
43716c7710
2 changed files with 40 additions and 4 deletions
36
levels.py
36
levels.py
|
|
@ -1,6 +1,9 @@
|
|||
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))
|
||||
|
|
@ -32,7 +35,6 @@ def level2(screen, sheet, screen_width, screen_height, lastclickpos, basicfont,
|
|||
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
|
||||
print(tick)
|
||||
dialog_square = pygame.surface.Surface((700, 68), pygame.SRCALPHA)
|
||||
dialog_square.fill((0, 0, 0))
|
||||
if 60 <= tick <= 400:
|
||||
|
|
@ -91,6 +93,32 @@ def level2(screen, sheet, screen_width, screen_height, lastclickpos, basicfont,
|
|||
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 >= 2201:
|
||||
level = 3
|
||||
return level # returns the current level set
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue