diff --git a/main.py b/main.py index 2e4c5ab..c0dfdfa 100644 --- a/main.py +++ b/main.py @@ -42,7 +42,7 @@ def genRooms(WIDTH, HEIGHT, type:str, objects:list): def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): main = [herbert] - mobs = [Skeleton(i, random.randint(40, 60), random.randint(50, WIDTH - 50), random.randint(50, HEIGHT - 50), 5, 1, 1, 1, 200) for i in range(0,random.randint(2, 5))]+[Zombie(i, random.randint(40, 60), random.randint(50, WIDTH-50), random.randint(50, HEIGHT-50), 5, 1, 1, 1, 25) for i in range(0,random.randint(2, 5))] + mobs = [Skeleton('skeleton', random.randint(40, 60), random.randint(50, WIDTH - 50), random.randint(50, HEIGHT - 50), 5, 1, 1, 1, 200) for i in range(0,random.randint(2, 5))]+[Zombie('zombie', random.randint(40, 60), random.randint(50, WIDTH-50), random.randint(50, HEIGHT-50), 5, 1, 1, 1, 25) for i in range(0,random.randint(2, 5))] weapons = [] others = [] npcs = [] diff --git a/viecher.py b/viecher.py index 9aa4fa1..a988bf9 100644 --- a/viecher.py +++ b/viecher.py @@ -74,7 +74,10 @@ class NPC(Objects): if self.talking: self.conversation.draw(screen) - def update(self, keys, objects): + def update(self, keys, objects): + if self.name == 'oldlady': + if self.conversation.convo_scene==0 and 'rat' in objects[0][0].killed and objects[1]==[]: + self.conversation.convo_scene=1 if self.lastUpdate + 200 < pg.time.get_ticks(): if self.talking: self.conversation.update(keys, objects) @@ -116,8 +119,12 @@ class Convo(Label): self.text = convo[2][self.convo_act] self.convo_act += 1 else: - if convo[0] == 'oldlady' and convo[1] == 0: - objects[1].append(Rat('r1', 200, 1000, 350, 1, 1, 1, 100, 25)) + if convo[0] == 'oldlady': + if convo[1] == 0: + objects[1].append(Rat('rat', 200, 1000, 350, 1, 1, 1, 100, 25)) + elif convo[1] == 1: + objects[0][0].level.level = 5 + while 'rat' in objects[0][0].killed: objects[0][0].remove('rat') self.convo_act = 0 self.npc.talking = False objects[0][0].talking = False @@ -168,9 +175,9 @@ class MainCharacter(Fighter): if touches is not None: if touches.name == 'fireplace': self.freezing = False - elif touches.name == 'portal': + elif touches.name == 'portal' and self.level.level != 1: return 'play' - elif touches.name == 'house': + elif touches.name == 'house' and self.level.level != 1: return 'house' elif 'wall' in touches.name: return 'wall' @@ -304,6 +311,9 @@ class Level(Label): def __init__(self, x, y, width, height, level, text, font='simple', font_size=20, font_color='#1e90ff', sprite='label.png') -> None: super().__init__(x, y, width, height, text, font, font_size, font_color, sprite) self.level = level + def draw(self, screen): + self.text = f'will to live: {self.level}%' + super().draw(screen) class Thinks(Label): def __init__(self, x, y, width, height, text, font='simple', font_size=15, font_color='#000000', sprite='thinks.png') -> None: @@ -411,6 +421,7 @@ class Mobs(Fighter): def hurt(self, damage, objects): self.health -= damage if self.health <= 0: + objects[0][0].killed.append(self.name) self.hidden = True objects[1].remove(self)