forked from InfoProjekt/game
		
	Development #7
					 2 changed files with 17 additions and 6 deletions
				
			
		
							
								
								
									
										2
									
								
								main.py
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								main.py
									
										
									
									
									
								
							|  | @ -42,7 +42,7 @@ def genRooms(WIDTH, HEIGHT, type:str, objects:list): | ||||||
|          |          | ||||||
| def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): | def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): | ||||||
|     main = [herbert] |     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 = [] |     weapons = [] | ||||||
|     others = [] |     others = [] | ||||||
|     npcs = [] |     npcs = [] | ||||||
|  |  | ||||||
							
								
								
									
										19
									
								
								viecher.py
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								viecher.py
									
										
									
									
									
								
							|  | @ -75,6 +75,9 @@ class NPC(Objects): | ||||||
|             self.conversation.draw(screen) |             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.lastUpdate + 200 < pg.time.get_ticks(): | ||||||
|             if self.talking: |             if self.talking: | ||||||
|                 self.conversation.update(keys, objects) |                 self.conversation.update(keys, objects) | ||||||
|  | @ -116,8 +119,12 @@ class Convo(Label): | ||||||
|                 self.text = convo[2][self.convo_act] |                 self.text = convo[2][self.convo_act] | ||||||
|                 self.convo_act += 1 |                 self.convo_act += 1 | ||||||
|             else: |             else: | ||||||
|                 if convo[0] == 'oldlady' and convo[1] == 0: |                 if convo[0] == 'oldlady': | ||||||
|                     objects[1].append(Rat('r1', 200, 1000, 350, 1, 1, 1, 100, 25)) |                     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.convo_act = 0 | ||||||
|                 self.npc.talking = False |                 self.npc.talking = False | ||||||
|                 objects[0][0].talking = False |                 objects[0][0].talking = False | ||||||
|  | @ -168,9 +175,9 @@ class MainCharacter(Fighter): | ||||||
|         if touches is not None: |         if touches is not None: | ||||||
|             if touches.name == 'fireplace': |             if touches.name == 'fireplace': | ||||||
|                 self.freezing = False |                 self.freezing = False | ||||||
|             elif touches.name == 'portal': |             elif touches.name == 'portal' and self.level.level != 1: | ||||||
|                 return 'play' |                 return 'play' | ||||||
|             elif touches.name == 'house': |             elif touches.name == 'house' and self.level.level != 1: | ||||||
|                 return 'house' |                 return 'house' | ||||||
|             elif 'wall' in touches.name: |             elif 'wall' in touches.name: | ||||||
|                 return 'wall' |                 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: |     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) |         super().__init__(x, y, width, height, text, font, font_size, font_color, sprite) | ||||||
|         self.level = level |         self.level = level | ||||||
|  |     def draw(self, screen): | ||||||
|  |         self.text = f'will to live: {self.level}%' | ||||||
|  |         super().draw(screen) | ||||||
| 
 | 
 | ||||||
| class Thinks(Label): | class Thinks(Label): | ||||||
|     def __init__(self, x, y, width, height, text, font='simple', font_size=15, font_color='#000000', sprite='thinks.png') -> None: |     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): |     def hurt(self, damage, objects): | ||||||
|         self.health -= damage |         self.health -= damage | ||||||
|         if self.health <= 0: |         if self.health <= 0: | ||||||
|  |             objects[0][0].killed.append(self.name) | ||||||
|             self.hidden = True |             self.hidden = True | ||||||
|             objects[1].remove(self) |             objects[1].remove(self) | ||||||
|      |      | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue