generated from dvorakmortonxd/pygame-template
early main menu
This commit is contained in:
parent
7d44582b07
commit
76695db6e6
6 changed files with 35 additions and 12 deletions
24
levels.py
24
levels.py
|
|
@ -1,10 +1,24 @@
|
|||
import pygame
|
||||
from render import load_sprite # this makes it so our function for rendering sprites from sprites.png is available in here
|
||||
|
||||
def level1(screen, sheet, lastclickpos, basicfont, mouse, click, level): # 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, 26, 8, 210, 60), (200, 200)) # this renders a button I made in the sprites.png, its purely for visual purposes so it doesnt matter where you click rn
|
||||
if click: # this checks if you clicked, when you clicked it does the following stuff under
|
||||
level = 2 # sets the level to 2
|
||||
print("yo") # prints out "yo" for debugging purposes, otherwise completely unnecessary
|
||||
def level1(screen, sheet, screen_width, screen_height, lastclickpos, basicfont, mouse, click, big_text, level): # 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))
|
||||
if click:
|
||||
level = 2
|
||||
else:
|
||||
screen.blit(load_sprite(sheet, 0, 36, 23, 10, 253, 110), (250, 250))
|
||||
if exitb_collision.collidepoint(mouse.get_pos()):
|
||||
screen.blit(load_sprite(sheet, 24, 36, 23, 10, 253, 110), (250, 400))
|
||||
if click:
|
||||
level = 0
|
||||
else:
|
||||
screen.blit(load_sprite(sheet, 0, 36, 23, 10, 253, 110), (250, 400))
|
||||
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, lastclickpos, basicfont, mouse, click, level): # function for level 2
|
||||
print("ur done") # prints out "ur done"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue