Seperating mapcompile into files.

This commit is contained in:
2025-06-23 14:02:32 -05:00
parent 344aaa7e4f
commit be5e972b32
6 changed files with 231 additions and 210 deletions

View File

@ -0,0 +1,20 @@
import os
import sys
def parseEntities(layers):
parsed = {
'playerSpawnX': 0,
'playerSpawnY': 0,
}
for ob in layers['objectLayer']['objects']:
if 'type' not in ob or ob['type'] != 'player_spawn':
continue
if 'x' not in ob or 'y' not in ob:
print(f"Error: Player spawn object does not contain 'x' or 'y' key.")
sys.exit(1)
parsed['playerSpawnX'] = ob['x']
parsed['playerSpawnY'] = ob['y']
break
return parsed