fied a bug were the game would crash during door creation

Signed-off-by: SpagettiFisch <63868515+SpagettiFisch@users.noreply.github.com>
This commit is contained in:
SpagettiFisch 2024-03-10 23:07:38 +01:00
parent 7709fd52f7
commit 3883237f91
2 changed files with 11 additions and 10 deletions

View file

@ -293,6 +293,7 @@ class Room(GameObjects):
return walls return walls
def createDoors(self, WIDTH): def createDoors(self, WIDTH):
if not self.type == 'boss':
if len(self.exits) == 1: if len(self.exits) == 1:
self.doors.append(Door(f'door{self.id}', self.exits[0][1], random.randint(64, round(WIDTH * 0.75)), 4, self.exits[0][0])) self.doors.append(Door(f'door{self.id}', self.exits[0][1], random.randint(64, round(WIDTH * 0.75)), 4, self.exits[0][0]))
elif len(self.exits) == 2: elif len(self.exits) == 2:

View file

@ -290,7 +290,7 @@ def options(screen, clock, running, background, isblack, WIDTH, HEIGHT):
def menu(screen, clock, running, background, isblack, WIDTH, HEIGHT): def menu(screen, clock, running, background, isblack, WIDTH, HEIGHT):
objects = [] objects = []
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'textbox.png', 'medieval', 48, "Play", play, attributes=[screen, clock, running, background, isblack, WIDTH, HEIGHT])) objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'textbox.png', 'medieval', 48, "Play", village, attributes=[screen, clock, running, background, isblack, WIDTH, HEIGHT]))
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'textbox.png', 'medieval', 48, "Options", uwu)) #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'textbox.png', 'medieval', 48, "Options", uwu))
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'textbox.png', 'medieval', 48, "Exit game", quitGame)) objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'textbox.png', 'medieval', 48, "Exit game", quitGame))
while running: while running: