I had actors working a while ago, but I only just added the functionality to place them using the editor.

I settled on treating actors as another node type. I considered treating them like sprites, which are not nodes but are kept inside rooms along with the tiles, or making everything potentially an actor by attaching arbitrary data. Using a specialised actor node seems like the sweet spot between clarity and flexibility.

Actors need data, and my plan was to use JSON again, attaching a file to each one. This turned out to be problematic. For one thing, I could not find a decent offline JSON editor. (Seriously? No one has written one of those?). I also didn’t fancy managing lots of little files with the scene. Anyway, it didn’t take long to write an embedded object editor using the immediate mode GUI.

The other thing actors need is connections to other actors . If I have a door actor, it needs a trigger zone that tells it to open. This has interesting implications for copy/paste. If I copy an actor, should it still be linked to the same actors as the original? I would say no; if I copy a door, it will probably need a different trigger zone. What if I copy a door and trigger zone together? Then the copies should be linked to each other, but not to the originals. If anyone ever decides to clone Kevin Bacon, I hope they take this into account.

Advertisements