Started entity parser
This commit is contained in:
14
tools/mapcompile/entityParser.py
Normal file
14
tools/mapcompile/entityParser.py
Normal 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
|
Reference in New Issue
Block a user