News for hackers. Stuff that matters.
Re:Superpowers, a collaborative HTML5 2D and 3D game maker, ... by elisee on Monday January 11, 2016 @04:21PM (#10883688)
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

There are no comments on this comment yet.