Merge remote-tracking branch 'origin/fix-paul'
1
DATA/Levels/Default/data.json
Normal file
108
DATA/Levels/level_1/data.json
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
BIN
DATA/Sprites/Enemies/Tier 0/healthy_food.aseprite
Normal file
BIN
DATA/Sprites/Enemies/Tier 0/healthy_food.png
Normal file
After Width: | Height: | Size: 173 B |
BIN
DATA/Sprites/Enemies/Tier 1/little-spider.aseprite
Normal file
BIN
DATA/Sprites/Enemies/Tier 1/little-spider.png
Normal file
After Width: | Height: | Size: 400 B |
BIN
DATA/Sprites/Floor/floor_grey.aseprite
Normal file
BIN
DATA/Sprites/Floor/floor_grey.png
Normal file
After Width: | Height: | Size: 142 B |
BIN
DATA/Sprites/Floor/move_ghost.aseprite
Normal file
BIN
DATA/Sprites/Floor/move_ghost.png
Normal file
After Width: | Height: | Size: 136 B |
BIN
DATA/Sprites/Floor/simple_border.aseprite
Normal file
BIN
DATA/Sprites/Floor/simple_border.png
Normal file
After Width: | Height: | Size: 213 B |
BIN
DATA/Sprites/Snake/body-rotate.aseprite
Normal file
BIN
DATA/Sprites/Snake/body-rotate.png
Normal file
After Width: | Height: | Size: 368 B |
BIN
DATA/Sprites/Snake/body.aseprite
Normal file
BIN
DATA/Sprites/Snake/body.png
Normal file
After Width: | Height: | Size: 371 B |
BIN
DATA/Sprites/Snake/head.aseprite
Normal file
BIN
DATA/Sprites/Snake/head.png
Normal file
After Width: | Height: | Size: 329 B |
BIN
DATA/Sprites/Snake/tail.aseprite
Normal file
BIN
DATA/Sprites/Snake/tail.png
Normal file
After Width: | Height: | Size: 315 B |
BIN
__pycache__/fill_level.cpython-313.pyc
Normal file
109
fill_level.py
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
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
@ -1,9 +0,0 @@
|
|||||||
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")
|
|