fixed a bug were the game would crash during door creation #81
2 changed files with 11 additions and 10 deletions
19
classes.py
19
classes.py
|
|
@ -293,15 +293,16 @@ class Room(GameObjects):
|
||||||
return walls
|
return walls
|
||||||
|
|
||||||
def createDoors(self, WIDTH):
|
def createDoors(self, WIDTH):
|
||||||
if len(self.exits) == 1:
|
if not self.type == 'boss':
|
||||||
self.doors.append(Door(f'door{self.id}', self.exits[0][1], random.randint(64, round(WIDTH * 0.75)), 4, self.exits[0][0]))
|
if len(self.exits) == 1:
|
||||||
elif len(self.exits) == 2:
|
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.45)), self.exits[0][0]))
|
elif len(self.exits) == 2:
|
||||||
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]))
|
self.doors.append(Door(f'door{self.id}', self.exits[0][1], random.randint(64, round(WIDTH * 0.45)), self.exits[0][0]))
|
||||||
else:
|
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]))
|
||||||
self.doors.append(Door(f'door{self.id}', self.exits[0][1], random.randint(64, round(WIDTH * 0.3)), self.exits[0][0]))
|
else:
|
||||||
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[0][1], random.randint(64, round(WIDTH * 0.3)), self.exits[0][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]))
|
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):
|
def update(self, objects):
|
||||||
if objects is not None:
|
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):
|
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:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue