Compare commits
	
		
			No commits in common. "7f6b65bdf377d96ca83fbb046fc6eb0cf690acb8" and "840a6fa783b570b31dfc622d6c0f5d88e39fc44e" have entirely different histories.
		
	
	
		
			7f6b65bdf3
			...
			840a6fa783
		
	
		
| @ -1,108 +0,0 @@ | ||||
| { | ||||
|     "name": "default", | ||||
|     "starting_position": { | ||||
|         "x": 6, | ||||
|         "y": 1 | ||||
|     }, | ||||
|     "enemies": [ | ||||
|         { | ||||
|             "type": "spider", | ||||
|             "sprite": "DATA/Sprites/Enemies/Tier 1/little-spider.png", | ||||
|             "x": 1, | ||||
|             "y": 6 | ||||
|         }, | ||||
|         { | ||||
|             "type": "spider", | ||||
|             "sprite": "DATA/Sprites/Enemies/Tier 1/little-spider.png", | ||||
|             "x": 1, | ||||
|             "y": 2 | ||||
|         }, | ||||
|         { | ||||
|             "type": "spider", | ||||
|             "sprite": "DATA/Sprites/Enemies/Tier 1/little-spider.png", | ||||
|             "x": 12, | ||||
|             "y": 3 | ||||
|         }, | ||||
|         { | ||||
|             "type": "spider", | ||||
|             "sprite": "DATA/Sprites/Enemies/Tier 1/little-spider.png", | ||||
|             "x": 10, | ||||
|             "y": 8 | ||||
|         } | ||||
|     ], | ||||
|     "floor": [ | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 0, | ||||
|             "x_start": 6, | ||||
|             "x_end": 8 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 1, | ||||
|             "x_start": 3, | ||||
|             "x_end": 11 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 1, | ||||
|             "x_start": 3, | ||||
|             "x_end": 11 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 2, | ||||
|             "x_start": 1, | ||||
|             "x_end": 12 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 3, | ||||
|             "x_start": 0, | ||||
|             "x_end": 12 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 4, | ||||
|             "x_start": 0, | ||||
|             "x_end": 12 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 5, | ||||
|             "x_start": 1, | ||||
|             "x_end": 13 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 6, | ||||
|             "x_start": 1, | ||||
|             "x_end": 13 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 7, | ||||
|             "x_start": 1, | ||||
|             "x_end": 13 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 8, | ||||
|             "x_start": 4, | ||||
|             "x_end": 11 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 9, | ||||
|             "x_start": 5, | ||||
|             "x_end": 8 | ||||
|         }, | ||||
|         { | ||||
|             "sprite": "DATA/Sprites/Floor/floor_grey.png", | ||||
|             "y": 10, | ||||
|             "x_start": 5, | ||||
|             "x_end": 6 | ||||
|         } | ||||
|     ] | ||||
| 
 | ||||
| } | ||||
| Before Width: | Height: | Size: 173 B | 
| Before Width: | Height: | Size: 400 B | 
| Before Width: | Height: | Size: 142 B | 
| Before Width: | Height: | Size: 136 B | 
| Before Width: | Height: | Size: 213 B | 
| Before Width: | Height: | Size: 368 B | 
| Before Width: | Height: | Size: 371 B | 
| Before Width: | Height: | Size: 329 B | 
| Before Width: | Height: | Size: 315 B | 
							
								
								
									
										109
									
								
								fill_level.py
									
									
									
									
									
								
							
							
						
						| @ -1,109 +0,0 @@ | ||||
| import json | ||||
| 
 | ||||
| 
 | ||||
| class filler(): | ||||
|     def __init__(self, name = "None", floor_code = []): | ||||
|         self.name = name | ||||
|         self.floor_code = floor_code if floor_code else self.get_default_floor_code() | ||||
|          | ||||
|     def export2json(self): | ||||
|         filename = f"DATA/Levels/{self.name}/data.json" | ||||
|         with open(filename, 'w') as f:  | ||||
|             json.dump(self.level_data, f) | ||||
| 
 | ||||
|     def fill_level(self, floor_code, name = "Default"): | ||||
|         self.level_data = { | ||||
|             "name": name, | ||||
|             "start_point": { | ||||
|                 "x": 4, | ||||
|                 "y": 8, | ||||
|             }, | ||||
|             "enemy_types": [ | ||||
|                 [ | ||||
|                     { | ||||
|                         "type": "little_spider", | ||||
|                         "sprite": "DATA/Sprites/Enemies/Tier 1/little-spider.png", | ||||
|                     } | ||||
|                 ], | ||||
|                 [ | ||||
|                     { | ||||
|                         "type": "wolf", | ||||
|                         "sprite": "DATA/Sprites/Enemies/Tier 2/wolf.png", | ||||
|                     } | ||||
|                 ], | ||||
|             ], | ||||
|             "enemy_spawns": [[ | ||||
|                  { "x" : 1, "y" : 3, "tier": 1, "sleep": 600, "delay": 600}, | ||||
|                  { "x" : 12, "y" : 7,"tier": 1, "sleep": 9000, "delay": 9000 }, | ||||
|                  { "x" : 1, "y" : 4, "tier": 1,"sleep": 800, "delay": 800 }, | ||||
|                  { "x" : 10, "y" : 0,"tier": 1, "sleep": 600, "delay": 600 } | ||||
|             ]], | ||||
|              | ||||
|             "size" : [], | ||||
|             "floor": [] | ||||
|         } | ||||
|         # Загрузка пола | ||||
|          | ||||
|         # floor_code - закодированная информация об уровне, представляет собой ас массив последовательностей 2х чисел: | ||||
|         # начало пола, конец пола | ||||
|         # Ключами являются координаты по y | ||||
|          | ||||
|         sprite  = "DATA/Sprites/Floor/floor_grey.png" | ||||
|         y = 0 | ||||
|         x_max = 1 | ||||
|         y_max = 1 | ||||
|          | ||||
|         while y < 15: | ||||
|             if y in floor_code: | ||||
|                 for x_len in floor_code[y]: | ||||
|                     x  = x_len["s"] | ||||
|                     while x <= x_len["e"]: | ||||
|                         if x > x_max: x_max = x | ||||
|                         self.level_data["floor"].append({"sprite": sprite, "x": x, "y": y}) | ||||
|                         x = x+1 | ||||
|                 if y > y_max: y_max = y | ||||
|                 y = y + 1 | ||||
|             else: | ||||
|                 break | ||||
|              | ||||
|         self.level_data["size"] = [x_max, y_max] | ||||
| 
 | ||||
|     def get_default_floor_code(self): | ||||
|         return { | ||||
|              0: [ | ||||
|                  { "s" : 5, "e" : 6 }, | ||||
|                  { "s" : 10, "e" : 12 }, | ||||
|              ], | ||||
|              1:[ | ||||
|                  { "s" : 5, "e" : 13 }, | ||||
|              ], | ||||
|              2:[ | ||||
|                  { "s" : 4, "e" : 13 }, | ||||
|              ], | ||||
|              3:[ | ||||
|                  { "s" : 1, "e" : 13 }, | ||||
|              ], | ||||
|              4:[ | ||||
|                  { "s" : 1, "e" : 13 }, | ||||
|              ], | ||||
|              5:[ | ||||
|                  { "s" : 1, "e" : 13 }, | ||||
|              ], | ||||
|              6:[ | ||||
|                  { "s" : 0, "e" : 12 }, | ||||
|              ], | ||||
|              7:[ | ||||
|                  { "s" : 0, "e" : 12 }, | ||||
|              ], | ||||
|              8:[ | ||||
|                  { "s" : 1, "e" : 12 }, | ||||
|              ], | ||||
|              9:[ | ||||
|                  { "s" : 3, "e" : 11 }, | ||||
|              ], | ||||
|              10:[ | ||||
|                  { "s" : 6, "e" : 8 }, | ||||
|              ] | ||||
|         } | ||||
| 
 | ||||
|          | ||||
							
								
								
									
										9
									
								
								main.py
									
									
									
									
									
								
							
							
						
						| @ -0,0 +1,9 @@ | ||||
| with open('data.txt', 'r') as file: | ||||
|     lines = file.readlines() | ||||
| 
 | ||||
| transformed_lines = [line.upper() for line in lines] | ||||
| 
 | ||||
| with open('output.txt', 'w') as output_file: | ||||
|     output_file.writelines(transformed_lines) | ||||
| 
 | ||||
| print("Данные успешно преобразованы и записаны в файл output.txt") | ||||