diff --git a/.idea/ideas.txt b/.idea/ideas.txt index 131e8a8..7cb1d6e 100644 --- a/.idea/ideas.txt +++ b/.idea/ideas.txt @@ -38,6 +38,7 @@ Story: Henker armer Bauer "Hexe" + Patrice, fragt nach Lightning Anschluss -> Lightning Spell freigeschaltet Ziel(e) -> Zurückkommen diff --git a/art/images/river.png b/art/images/river.png new file mode 100644 index 0000000..2bc2348 Binary files /dev/null and b/art/images/river.png differ diff --git a/classes.py b/classes.py index f8fffb8..089c2b5 100644 --- a/classes.py +++ b/classes.py @@ -182,15 +182,16 @@ class Scene(GameObjects): super().__init__(name, _type, bg, objects, WIDTH, HEIGHT) self.level = level self.current_level = 0 + self.update() - def update(self, change:bool, objects): + def update(self, change:bool=False, objects=None): if change: self.current_level += 1 self.level[self.current_level].update(objects) self.background = self.level[self.current_level].background - if isinstance(self.objects, list): + """if isinstance(self.objects, list): for obj in self.objects[0] + self.objects[1] + self.objects[2]: - obj.update() + obj.update()""" def draw(self, screen): if isinstance(self.objects, list): @@ -250,7 +251,8 @@ class Room(GameObjects): return walls def update(self, objects): - self.objects = objects + if objects is not None: + self.objects = objects if not self.objects[1]: self.locked = False return diff --git a/main.py b/main.py index 0721bb2..f4796ed 100644 --- a/main.py +++ b/main.py @@ -27,12 +27,13 @@ def quitGame(): quit() def genRooms(WIDTH, HEIGHT, type:str, objects:list): - room_objects = [Obstacle('dirt', 'boulder', 'art/images/dirt2.png', False, 32, 32, WIDTH=WIDTH - 64, HEIGHT=HEIGHT - 64)] - room_objects.append(Obstacle('river', 'water', 'art/images/river1.png', True, 32, 32, WIDTH=WIDTH - 64, HEIGHT=HEIGHT - 64)) + room_objects = [] + #room_objects = [Obstacle('dirt', 'boulder', 'art/images/dirt2.png', False, 32, 32, WIDTH=WIDTH - 64, HEIGHT=HEIGHT - 64)] + room_objects.append(Obstacle('river', 'water', 'art/images/river.png', True, random.randint(32, round(WIDTH * 0.75)), 32, WIDTH=96, HEIGHT=round(HEIGHT * 0.66))) rooms = [ - Room(type, 'normal', f'art/images/{type}.png', [objects[0], objects[1], objects[2], [room_objects[random.randint(0, len(room_objects) - 1)] for i in range(0, 5)]], WIDTH - 64, HEIGHT - 64, [True, True, True, False], 0), - Room(type, 'normal', f'art/images/{type}.png', [objects[0], objects[1], objects[2], [room_objects[random.randint(0, len(room_objects) - 1)] for i in range(0, 5)]], WIDTH - 64, HEIGHT - 64, [True, True, True, False], 1), - Room(type, 'normal', f'art/images/{type}.png', [objects[0], objects[1], objects[2], [room_objects[random.randint(0, len(room_objects) - 1)] for i in range(0, 5)]], WIDTH - 64, HEIGHT - 64, [True, True, True, False], 2), + Room(type, 'normal', f'art/images/{type}.png', [objects[0], objects[1], objects[2], [room_objects[random.randint(0, len(room_objects) - 1)] for i in range(0, random.randint(0, 1))]], WIDTH - 64, HEIGHT - 64, [True, True, True, False], 0), + Room(type, 'normal', f'art/images/{type}.png', [objects[0], objects[1], objects[2], [room_objects[random.randint(0, len(room_objects) - 1)] for i in range(0, random.randint(0, 1))]], WIDTH - 64, HEIGHT - 64, [True, True, True, False], 1), + Room(type, 'normal', f'art/images/{type}.png', [objects[0], objects[1], objects[2], [room_objects[random.randint(0, len(room_objects) - 1)] for i in range(0, random.randint(0, 1))]], WIDTH - 64, HEIGHT - 64, [True, True, True, False], 2), ] return rooms @@ -66,7 +67,6 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): screen.blit(bg, (0, 0)) """ if not freeze: - scene.update(False, objects) objects = scene.getObjects() screen.blit(scene.background, (32, 32)) for thing in objects[3]: @@ -88,6 +88,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): npc.draw(screen) objects[0][0].book.addspell('windslash') + scene.update(False, objects) else: