Seperating mapcompile into files.
This commit is contained in:
20
tools/mapcompile/entityParse.py
Normal file
20
tools/mapcompile/entityParse.py
Normal 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
|
Reference in New Issue
Block a user