#!/usr/bin/env python3 import pygame import variables import levels def main(width=variables.screen_width, height=variables.screen_height, fps=variables.screen_fps): pygame.init() screen = pygame.display.set_mode((width, height)) pygame.display.set_caption("sas2py") basicfont = pygame.font.Font(None, 24) gamefont = pygame.font.Font("KiwiSoda.ttf", 40) chunkygamefont = pygame.font.Font("KiwiSoda.ttf", 60) chunkyfont = pygame.font.Font(None, 100) smallergamefont = pygame.font.Font("KiwiSoda.ttf", 23) clock = pygame.time.Clock() sheet = pygame.image.load("sprites.png").convert_alpha() running = True while running: 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 match event.key: case pygame.K_ESCAPE: running = False case pygame.K_SLASH: if variables.devmode: variables.level = 4 variables.dialognum = 4 variables.playername = "BlackNagger" case pygame.K_SPACE: if variables.devmode: variables.hairstyle += 1 variables.stubble += 1 variables.skincolor += 1 case pygame.K_BACKSPACE: if variables.devmode: variables.skincolor -= 1 variables.hairstyle -= 1 variables.stubble -= 1 case 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() match variables.level: case 1: levels.level1(screen, sheet, gamefont, variables.screen_width/2-100, variables.screen_height/2+120, pygame.mouse, variables.clicked, variables.lastclickpos) case 2: levels.level2(screen, sheet, smallergamefont, variables.screen_width/2-100, variables.screen_height/2+120, pygame.mouse, variables.clicked, variables.lastclickpos) case 3: levels.level3(screen, sheet, smallergamefont, pygame.mouse, variables.clicked, variables.lastclickpos, variables.playername, smallergamefont, variables.ticks, variables.screen_fps, chunkyfont) case 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) case 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) clock.tick(fps) variables.ticks += 1 if variables.ticks > fps: variables.ticks = 0 fps_text = basicfont.render(str(int(clock.get_fps())), True, (0, 255, 0)) screen.blit(fps_text, (5, 5)) pygame.display.flip() pygame.quit() if __name__ == "__main__": main()