diff --git a/art/images/start.png b/art/images/start.png new file mode 100644 index 0000000..3d7f7c5 Binary files /dev/null and b/art/images/start.png differ diff --git a/classes.py b/classes.py index 8067e11..d288c1d 100644 --- a/classes.py +++ b/classes.py @@ -137,10 +137,24 @@ class DropDown(): return -1 -class Scene(): - def __init__(self, _type, bg, objects) -> None: - self.name +class GameObjects(): + def __init__(self, name:str, _type:str, bg, objects:list) -> None: + self.name = name self.type = _type - if self.type != 'cutscene': - self.background = bg - self.objects = objects + self.background = bg + self.objects = objects + + +class Scene(GameObjects): + def __init__(self, name:str, _type:str, bg, objects:list) -> None: + super().__init__(name, _type, bg, objects) + + +class Room(GameObjects): + def __init__(self, name:str, _type:str, bg, objects:list, exits:list) -> None: + super().__init__(name, _type, bg, objects) + self.exits = exits + if self.type == 'normal' or self.type == 'boss': + self.locked = True + else: + self.locked = False diff --git a/main.py b/main.py index 6aecc76..d4c669f 100644 --- a/main.py +++ b/main.py @@ -24,10 +24,7 @@ def readConfig(): def quitGame(): #save progress somehow, if needed pygame.quit() - sys.exit() - -def uwu(): - print('uwu') + quit() def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): objects = [] @@ -92,15 +89,16 @@ def options(screen, clock, running, background, isblack, WIDTH, HEIGHT): def menu(screen, clock, running, background, isblack, WIDTH, HEIGHT): objects = [] - objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame)) objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Play", play)) - objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Options", uwu)) + #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Options", uwu)) + objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame)) while running: for event in pygame.event.get(): if event.type == pygame.QUIT: - running = False + running = False + quitGame() # RENDER YOUR GAME HERE - with open(background, 'r') as i: + with open(f'art/images/{background}', 'r') as i: bg = pygame.image.load(i) bg = pygame.transform.scale(bg, (WIDTH, HEIGHT)) # fill the screen with an image to clear the screen @@ -117,11 +115,11 @@ def main(): config = readConfig() screen, clock, running, isblack, background, objects = setUp(config["screen"]) WIDTH, HEIGHT = screen.get_size() - objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame)) - objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Options", uwu)) - objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Play", play)) - - while running: + #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Play", play)) + #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Options", uwu)) + #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame)) + menu(screen, clock, running, background, isblack, WIDTH, HEIGHT) + """while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False @@ -141,7 +139,7 @@ def main(): # flip() the display to put your work on screen pygame.display.flip() - clock.tick(60) # limits FPS to 60 + clock.tick(60) # limits FPS to 60""" pygame.quit()