From dca14abe57d3e01bebe250dad2be7bb71888f0c8 Mon Sep 17 00:00:00 2001 From: dvorakmortonxd Date: Fri, 29 May 2026 09:57:18 +0200 Subject: [PATCH] finally functional, next step: add comments --- levels.py | 11 ++++++++ main.py | 73 ++++++++++++++++------------------------------------ sprites.png | Bin 0 -> 4281 bytes sprites.pxo | Bin 0 -> 5289 bytes 4 files changed, 33 insertions(+), 51 deletions(-) create mode 100644 levels.py create mode 100644 sprites.png create mode 100644 sprites.pxo diff --git a/levels.py b/levels.py new file mode 100644 index 0000000..1bf07b3 --- /dev/null +++ b/levels.py @@ -0,0 +1,11 @@ +from render import load_sprite + +def level1(screen, sheet, lastclickpos, basicfont, mouse, click, level): + screen.blit(load_sprite(sheet, 0, 0, 26, 8, 210, 60), (200, 200)) + if click: + level = 2 + print("yo") + return level +def level2(screen, sheet, lastclickpos, basicfont, mouse, click, level): + print("ur done") + return level \ No newline at end of file diff --git a/main.py b/main.py index 2cff679..5fd9b9d 100644 --- a/main.py +++ b/main.py @@ -8,66 +8,37 @@ screen_height = 500 window_fps = 60 title = "Example Title" -def main(width=screen_width, height=screen_height, fps=window_fps): +def main(fps=window_fps): pygame.init() - screen = pygame.display.set_mode((width, height)) - pygame.display.set_caption(title) - clock = pygame.time.Clock() sheet = pygame.image.load("sprites.png") + lastclickpos = [0, 0] + screen = pygame.display.set_mode((screen_width, screen_height)) + pygame.display.set_caption(title) + basicfont = pygame.font.SysFont(None, 30) + clock = pygame.time.Clock() + click = False + sheet = pygame.image.load("sprites.png") + level = 1 running = True while running: + screen.fill((0, 0, 0)) for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # Fill these in with your logic if event.type == pygame.KEYDOWN: - if variables.level == 3 and variables.canyoutypethename == True: - name = pygame.key.name(event.key) - if name == "backspace": - variables.playername = variables.playername[:-1] - elif len(variables.playername) >= 12: - pass - elif name == "return" or name == "space": - pass - elif len(name) == 1:# and name.isalpha(): - variables.playername += str(name) - # Example: print(event.key) or handle input - if event.key == pygame.K_ESCAPE: - running = False - elif event.key == pygame.K_SLASH: - if variables.devmode: - variables.level = 4 - variables.dialognum = 4 - variables.playername = "BlackNagger" - elif event.key == pygame.K_SPACE: - if variables.devmode: - variables.hairstyle += 1 - variables.stubble += 1 - variables.skincolor += 1 - elif event.key == pygame.K_BACKSPACE: - if variables.devmode: - variables.skincolor -= 1 - variables.hairstyle -= 1 - variables.stubble -= 1 - elif event.key == pygame.K_CAPSLOCK: - if variables.devmode: - variables.playerstrength += 1 - if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: - variables.clicked = True - variables.lastclickpos = pygame.mouse.get_pos() - if variables.level == 1: - levels.level1(screen, sheet, gamefont, variables.screen_width/2-100, variables.screen_height/2+120, pygame.mouse, variables.clicked, variables.lastclickpos) - elif variables.level == 2: - levels.level2(screen, sheet, smallergamefont, variables.screen_width/2-100, variables.screen_height/2+120, pygame.mouse, variables.clicked, variables.lastclickpos) - elif variables.level == 3: - levels.level3(screen, sheet, smallergamefont, pygame.mouse, variables.clicked, variables.lastclickpos, variables.playername, smallergamefont, variables.ticks, variables.screen_fps, chunkyfont) - elif variables.level == 4: - levels.level4(screen, sheet, smallergamefont, pygame.mouse, variables.clicked, variables.lastclickpos, variables.playername, smallergamefont, variables.ticks, variables.screen_fps, chunkyfont, chunkygamefont, variables.unlimited_slappeartext) - elif variables.level == 5: - levels.level5(screen, sheet, smallergamefont, pygame.mouse, variables.clicked, variables.lastclickpos, variables.playername, smallergamefont, variables.ticks, variables.screen_fps, chunkyfont, chunkygamefont, variables.unlimited_slappeartext) - variables.ticks += 1 - if variables.ticks > fps: - variables.ticks = 0 + if event.key == pygame.K_ESCAPE: # put in here some action yknow + pygame.quit() + if event.type == pygame.MOUSEBUTTONDOWN: + click = True + print(pygame.mouse.get_pos()) + lastclickpos = pygame.mouse.get_pos() + if event.type == pygame.MOUSEBUTTONUP: + click = False + if level == 1: + level = levels.level1(screen, sheet, lastclickpos, basicfont, pygame.mouse, click, level) + elif level == 2: + level = levels.level2(screen, sheet, lastclickpos, basicfont, pygame.mouse, click, level) fps_text = basicfont.render(str(int(clock.get_fps())), True, (0, 255, 0)) screen.blit(fps_text, (5, 5)) pygame.display.flip() diff --git a/sprites.png b/sprites.png new file mode 100644 index 0000000000000000000000000000000000000000..7bcb86e242d98dfd91a1142a10a7d9ace8ff881f GIT binary patch literal 4281 zcmeAS@N?(olHy`uVBq!ia0y~yU;#2&7&zE~RK2WrGmv5|4sv&5Sa(k5B?E&%v8Rh; zNX4ADcYV2<4FuRO^rUb6ZXZxBw!AxJ!h%a(zV#LP!Uk-2&($=$Nfv9_-bs4#Nd{;} z!qFMQX}L^iUe7yI^}9gz8F(!wcG7t)`Zh=0pHb^q4xdwy&- zriwrbhCNr)Ched8$^FQMcly#CK!F40H+63Gt9(Cg{5j;{MR8`J&^clC`UU!O+0V94 z*`ZVRhZUsnU-uJv5IqV;Ltr!nMnhmU1V%$(Gz3ONU^E0qLtr!nMnhmU1V%$(Gz12J b2s|i$*OnA3n4xc;26C*YtDnm{r-UW|6mVJx literal 0 HcmV?d00001 diff --git a/sprites.pxo b/sprites.pxo new file mode 100644 index 0000000000000000000000000000000000000000..efd09b94adef7a9e722e4f10c7829b16d9734019 GIT binary patch literal 5289 zcmWIWW@Zs#VBp|j2y)#UbNo|_at9*=gC8>k11AFmLrP*vqFz>UeqL)(blxEYfjwNG z!nGNdYP~F-^8*yKJFI@lajO{w4 z@i-;fOXR1veDw1G_DIVNiJNCSnmX3GZ`gdSkW+KY)I#1C>xl1n7hP>^IuxYinp*kb z_N>=cuT1``aD^P6&&E7Oz~RaA&p{I0tgRZKbgph!sh)V|`-a4X!q1;i+;R8Zb)+wJ z&dtD^Rval`Zq)hCUH5w0sgpJDGXpjRuQ+Yk{v>MR)+O0D8~%$`vYt|oUZbUR=t@pk z{x-9_ccUbje|Rv9NoHU9p*%TurAPesyH#5!Y!dsa72PH9cEQvC417;Ic{^-&h)q5j zZ73$vW-xQx6~)bt%%2Xt`@Q6dVs!fJ?^F3FRO~o0Q-7P*^0)mWmy?2B)1TGVS@LN= zxx}Pu8sLA}MmF$M+NQIYPgitJ56+2L-hD~xQthf9`^{?~9=^-?YNGm*@TuFBt#>l} z*QxE@-&LDqEcbkx{l^O5r-e}kuP>fdJeu-@Vb&kJy`A0n-u@I1K#8thetnC$fzbqt zDh?pd&CE?LsVqo6ea6?v|Em6q6YLDA8XirWx4i92V{ z6hD7D=}}Tb!h^403OIpu3PU2FnSyBW7A4*z+I&UjNfG6K&r~PmK6v>^BFOOh+f?^^ z%v?fB%_VKfJ>Yzn#@DgbmDg9C#!kj%_YOizsmB}4tRqQu}$O;q>3$)PL^GXAs%1Z>;|(N)*5Q{tu-1&!v^-j6h>Y!DtAKhQMeD zjE2By2#kinXb6mkz-S1JhQMeDjE2By2#kin5D0+^S6%Spld`Qd4XwTU}yyT2Aj{JK1MePJ