generated from dvorakmortonxd/pygame-template
finished the main menu, did this in school so not too much of a change
This commit is contained in:
parent
731ba1053e
commit
2925a24a46
6 changed files with 36 additions and 8 deletions
8
main.py
8
main.py
|
|
@ -5,6 +5,7 @@ window_fps = 60 # the frames per second, this decides how fast the main loop ru
|
|||
|
||||
def main(fps=window_fps): # the main function
|
||||
pygame.init() # initalizes pygame
|
||||
tick = 0
|
||||
screen_width = 912 # the screen width
|
||||
screen_height = 576 # the screen height
|
||||
# THE SCREEN IS 19:12 RATIO
|
||||
|
|
@ -12,7 +13,10 @@ def main(fps=window_fps): # the main function
|
|||
lastclickpos = [0, 0] # last position that was clicked, this changes every time you click somewhere on the game window
|
||||
screen = pygame.display.set_mode((screen_width, screen_height)) # this initalizes the display with the screen_width and screen_height variables
|
||||
pygame.display.set_caption(title) # this actually sets the title of the window from the title variable
|
||||
basicfont = pygame.font.SysFont(None, 30) # this sets a basic font for now, we can change this to anything later on
|
||||
basicfont = pygame.font.Font('KiwiSoda.ttf', 50) # this sets a basic font for now, we can change this to anything later on
|
||||
bigfont = pygame.font.Font('KiwiSoda.ttf', 80)
|
||||
slightly_smaller_than_bigfont = pygame.font.Font('KiwiSoda.ttf', 70)
|
||||
smallfont = pygame.font.Font('KiwiSoda.ttf', 30)
|
||||
clock = pygame.time.Clock() # this is used to control the fps of the game if you scroll down the code a bit
|
||||
click = False # variable I use to check if u clicked with the mouse when calling level function from levels.
|
||||
sheet = pygame.image.load("sprites.png") # the sprite sheet which we then use to load specific sprites from
|
||||
|
|
@ -33,7 +37,7 @@ def main(fps=window_fps): # the main function
|
|||
if event.type == pygame.MOUSEBUTTONUP: # what happens when you release a mouse button
|
||||
click = False # sets the click variable to False so level function in levels.py can see again
|
||||
if level == 1: # what happens when the level variable is equal to 1
|
||||
level = levels.level1(screen, sheet, lastclickpos, basicfont, pygame.mouse, click, level) # 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) # runs the level1 function from levels.py
|
||||
|
||||
# THE REASON WE CALL IT LIKE THIS INSTEAD OF NORMALLY IS SO WE CAN CHANGE THE LEVEL VARIABLE
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue