Started entity parser

This commit is contained in:
2025-06-23 16:30:56 -05:00
parent 39ac4b9fb9
commit 22af9d1507
3 changed files with 35 additions and 18 deletions

View File

@ -0,0 +1,14 @@
from constants import TILE_WIDTH_HEIGHT, ENTITY_TYPE_MAP
def parseEntity(obj, chunkData):
if 'type' in obj and obj['type'] not in ENTITY_TYPE_MAP:
return None
obj['localX'] = round(obj['x'] - (chunkData['topLeftTileX'] * TILE_WIDTH_HEIGHT))
obj['localY'] = round(obj['y'] - (chunkData['topLeftTileY'] * TILE_WIDTH_HEIGHT))
obj['dir'] = 'ENTITY_DIR_SOUTH'
obj['type'] = 'ENTITY_TYPE_NPC'
print(obj)
return obj