2 ms·
Behaviors are simply added to a list of components on the actor (aka "game object") and once a tick, the whole actor tree is update()'d. There are probably opti
by elisee 11y ago
Behaviors are simply added to a list of components on the actor (aka "game object") and once a tick, the whole actor tree is update()'d. There are probably optimizations to be done here, but we haven't hit the wall yet so we're trucking along on more urgent stuff :)
Communicating with another behavior can be done like so:
Sup.getActor("Some actor").getBehavior(BehaviorClass).someMethod();
If you use an actor or a behavior often, you'll want to cache it into a member variable so you don't look it up every frame.
By the way, we have open sourced all the games we've made for Ludum Dare and the Global Game Jam over the last year, you might like checking them out: https://github.com/superpowers-extra https://github.com/superpowers-extra