finished the main menu, did this in school so not too much of a change

This commit is contained in:
dvorakmortonxd 2026-06-05 13:01:19 +02:00
commit 2925a24a46
6 changed files with 36 additions and 8 deletions

View file

@ -1,10 +1,32 @@
from render import load_sprite # this makes it so our function for rendering sprites from sprites.png is available in here
import pygame
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, 57, 36, 912, 576), (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
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, tick, slightfont): # 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, 56, 35, 912, 576), (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 = slightfont.render("THE DESTROYER OF CITIES", True, (210, 210, 210))
playb_collision = pygame.Rect(315, 200, 285, 105)
exitb_collision = pygame.Rect(315, 350, 285, 105)
if playb_collision.collidepoint(mouse.get_pos()):
screen.blit(load_sprite(sheet, 57, 7, 19, 7, 285, 105), (315, 200))
play_text = basicfont.render("Play", True, (0,0,0))
if click:
level = 2
else:
screen.blit(load_sprite(sheet, 57, 0, 19, 7, 285, 105), (315, 200))
play_text = basicfont.render("Play", True, (255,255,255))
screen.blit(play_text, (414, 230))
if exitb_collision.collidepoint(mouse.get_pos()):
screen.blit(load_sprite(sheet, 57, 7, 19, 7, 285, 105), (315, 350))
exit_text = basicfont.render("Exit", True, (0,0,0))
if click:
level = 0
else:
screen.blit(load_sprite(sheet, 57, 0, 19, 7, 285, 105), (315, 350))
exit_text = basicfont.render("Exit", True, (255,255,255))
screen.blit(exit_text, (414, 380))
screen.blit(mainmenu_text, (45, 65))
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"