working with Impactjs, a game engine, here and levels have this very strange setup:
[
{
"entities": [
{"type":"type1","x":100,"y":100,"settings":{"directsTo":"-5"}},
{"type":"type2","x":101,"y":101,"settings":{"directsTo":"-4"}}
],
"layer": [
other data
]
}
]
I'm wondering how one gets the index of the type1 object based off of the directsTo property of the settings object?
Javascript or jQuery would be fine.
Edit: The game has to work on smoothly on mobile so having an efficient solution is good.