Can I set a hash/Array as go.property so that I can add other game objects to it?
The goal is that I have an object and I want it to patrol between different points, those points should be game objects and it should target them one at a time. First problem I encountered is how to link the patrolling object to the target objects.
I’m afraid you can’t set a Lua table as a go.property(). You would either have to have one go.property() per point to patrol or set it all up in code.
You could set it up the other way around.
Let the points post a message to the patrolling object on init. In the patrolling object you can listen for that message and store the sender in a lua table.
If you want them to appear in a specific order you could just add a go.property to the point script and set an order number.
Yeah, I might give it a try, but having the option to use tables as an exposed property would have been much easier, I’m struggling a bit with the messaging system design approach, it’s different from what I’m used to.
If it is of any comfort, me developing Blossom Blast Saga on this engine had the same feeling at start. It took a while to find a good way to design the game not “fighting against” the engine.
Still I use some lookuptables as I’m passing in simple keys in the gameobjects when necessary.
As always… next game will be better designed