Merge remote-tracking branch 'origin/fix-paul'

This commit is contained in:
Doom-JSlayer 2025-05-06 15:28:19 +03:00
commit 7f6b65bdf3
23 changed files with 218 additions and 9 deletions

File diff suppressed because one or more lines are too long

View 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
}
]
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

BIN
DATA/Sprites/Snake/body.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

BIN
DATA/Sprites/Snake/head.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

BIN
DATA/Sprites/Snake/tail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

109
fill_level.py Normal file
View 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 },
]
}

View File

@ -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")