forked from InfoProjekt/game
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:
parent
7709fd52f7
commit
3883237f91
2 changed files with 11 additions and 10 deletions
19
classes.py
19
classes.py
|
|
@ -293,15 +293,16 @@ class Room(GameObjects):
|
|||
return walls
|
||||
|
||||
def createDoors(self, WIDTH):
|
||||
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]))
|
||||
elif len(self.exits) == 2:
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[0][1], random.randint(64, round(WIDTH * 0.45)), self.exits[0][0]))
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[1][1], random.randint(round(WIDTH * 0.5), round(WIDTH * 0.9)), self.exits[1][0]))
|
||||
else:
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[0][1], random.randint(64, round(WIDTH * 0.3)), self.exits[0][0]))
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[1][1], random.randint(round(WIDTH * 0.33), round(WIDTH * 0.6)), self.exits[1][0]))
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[2][1], random.randint(round(WIDTH * 0.63), round(WIDTH * 0.95)), self.exits[2][0]))
|
||||
if not self.type == 'boss':
|
||||
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]))
|
||||
elif len(self.exits) == 2:
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[0][1], random.randint(64, round(WIDTH * 0.45)), self.exits[0][0]))
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[1][1], random.randint(round(WIDTH * 0.5), round(WIDTH * 0.9)), self.exits[1][0]))
|
||||
else:
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[0][1], random.randint(64, round(WIDTH * 0.3)), self.exits[0][0]))
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[1][1], random.randint(round(WIDTH * 0.33), round(WIDTH * 0.6)), self.exits[1][0]))
|
||||
self.doors.append(Door(f'door{self.id}', self.exits[2][1], random.randint(round(WIDTH * 0.63), round(WIDTH * 0.95)), self.exits[2][0]))
|
||||
|
||||
def update(self, objects):
|
||||
if objects is not None:
|
||||
|
|
|
|||
2
main.py
2
main.py
|
|
@ -290,7 +290,7 @@ 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, 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, "Exit game", quitGame))
|
||||
while running:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue