forked from InfoProjekt/game
		
	InfoProjekt-Development3 #6
					 3 changed files with 20 additions and 8 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								art/images/portal.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								art/images/portal.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 626 B | 
							
								
								
									
										16
									
								
								main.py
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								main.py
									
										
									
									
									
								
							|  | @ -52,7 +52,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): | ||||||
|     rooms = genRooms(WIDTH, HEIGHT, 'grass', objects) |     rooms = genRooms(WIDTH, HEIGHT, 'grass', objects) | ||||||
|     level.append(Stage('blau', 'normal', None, [], WIDTH, HEIGHT, 'blue', rooms)) |     level.append(Stage('blau', 'normal', None, [], WIDTH, HEIGHT, 'blue', rooms)) | ||||||
|     scene = Scene('test', 'normal', None, None, WIDTH, HEIGHT, level) |     scene = Scene('test', 'normal', None, None, WIDTH, HEIGHT, level) | ||||||
|     freeze = True #Gameplay is freezed in certain situations |     freeze = False #Gameplay is freezed in certain situations | ||||||
| 
 | 
 | ||||||
|     while running: |     while running: | ||||||
|         screen.fill('#000000') |         screen.fill('#000000') | ||||||
|  | @ -85,7 +85,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): | ||||||
|             for thing in objects[0]: |             for thing in objects[0]: | ||||||
|                 thing.book.hidden = not freeze |                 thing.book.hidden = not freeze | ||||||
|                 if not thing.update(pygame.key.get_pressed(), pygame.mouse.get_pos(), objects): |                 if not thing.update(pygame.key.get_pressed(), pygame.mouse.get_pos(), objects): | ||||||
|                     menu(screen, clock, running, background, isblack, WIDTH, HEIGHT) |                     village(screen, clock, running, background, isblack, WIDTH, HEIGHT) | ||||||
|                 thing.draw(screen) |                 thing.draw(screen) | ||||||
|          |          | ||||||
|             for mob in objects[1]: |             for mob in objects[1]: | ||||||
|  | @ -99,7 +99,6 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): | ||||||
|             objects[0][0].book.addspell('windslash') |             objects[0][0].book.addspell('windslash') | ||||||
|             scene.update(False, objects) |             scene.update(False, objects) | ||||||
| 
 | 
 | ||||||
|          |  | ||||||
|         else: |         else: | ||||||
|             objects[0][0].book.hidden = not freeze |             objects[0][0].book.hidden = not freeze | ||||||
|             objects[0][0].book.draw(screen) |             objects[0][0].book.draw(screen) | ||||||
|  | @ -113,7 +112,7 @@ def village(screen, clock, running, background, isblack, WIDTH, HEIGHT): | ||||||
|     main = [MainCharacter('Herbert', 100, 'people/oldman.png', 500, 500, 20, 5, 1, 1, 50)] |     main = [MainCharacter('Herbert', 100, 'people/oldman.png', 500, 500, 20, 5, 1, 1, 50)] | ||||||
|     mobs = [] |     mobs = [] | ||||||
|     weapons = [] |     weapons = [] | ||||||
|     others = [Fire('f1', 0, 200, 300)] |     others = [Fire('f1', 0, 200, 300), Portal('p1', 0, 1000, 500)] | ||||||
|     npcs = [NPC('name', 100, 'people/oldlady.png', 1, 200, 200)] |     npcs = [NPC('name', 100, 'people/oldlady.png', 1, 200, 200)] | ||||||
|     objects = [main, mobs, npcs, weapons, others] |     objects = [main, mobs, npcs, weapons, others] | ||||||
|     room = Room('village', 'village', 'art/images/background/village.png', objects, WIDTH - 64, HEIGHT - 64, [True, True, True, True], 0) |     room = Room('village', 'village', 'art/images/background/village.png', objects, WIDTH - 64, HEIGHT - 64, [True, True, True, True], 0) | ||||||
|  | @ -139,14 +138,15 @@ def village(screen, clock, running, background, isblack, WIDTH, HEIGHT): | ||||||
|             objects = room.getObjects() |             objects = room.getObjects() | ||||||
|             screen.blit(room.background, (32, 32)) |             screen.blit(room.background, (32, 32)) | ||||||
|          |          | ||||||
|  |             for thing in objects[4]: | ||||||
|  |                 if thing.update(objects): | ||||||
|  |                     play(screen, clock, running, background, isblack, WIDTH, HEIGHT) | ||||||
|  |                 thing.draw(screen) | ||||||
|  | 
 | ||||||
|             for weapon in objects[3]: |             for weapon in objects[3]: | ||||||
|                 weapon.update(objects) |                 weapon.update(objects) | ||||||
|                 weapon.draw(screen) |                 weapon.draw(screen) | ||||||
| 
 | 
 | ||||||
|             for thing in objects[4]: |  | ||||||
|                 thing.update(objects) |  | ||||||
|                 thing.draw(screen) |  | ||||||
| 
 |  | ||||||
|             for thing in objects[0]: |             for thing in objects[0]: | ||||||
|                 thing.book.hidden = not freeze |                 thing.book.hidden = not freeze | ||||||
|                 if not thing.update(pygame.key.get_pressed(), pygame.mouse.get_pos(), objects): |                 if not thing.update(pygame.key.get_pressed(), pygame.mouse.get_pos(), objects): | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								viecher.py
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								viecher.py
									
										
									
									
									
								
							|  | @ -481,4 +481,16 @@ class Fire(Objects): | ||||||
| 
 | 
 | ||||||
|     def update(self, objects): |     def update(self, objects): | ||||||
|         self.warming(objects) |         self.warming(objects) | ||||||
|  |         return False | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | class Portal(Objects): | ||||||
|  |     def __init__(self, name, ms, x, y, sprite='portal.png') -> None: | ||||||
|  |         super().__init__(name, ms, sprite, x, y) | ||||||
|  |      | ||||||
|  |     def update(self, objects): | ||||||
|  |         touches = pg.sprite.spritecollideany(self, objects[0]) | ||||||
|  |         if touches is not None and isinstance(touches, MainCharacter): | ||||||
|  |             return True | ||||||
|  |         else: | ||||||
|  |             return False | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue