Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Ok, if I'm understanding this right, to get a behavior it must be printed to superpowers log using Sup.Log(<value retrieved somewhere stored>) which can be an actor so Sup.log(<ActiorName>.getBehavior(<BehaviorName>).<VariableName>); and lets say I wanted to run update tests against this value or another value (like its position overlapping a damaging tile) I would run positional checks in code against the Superpowers Actor class (Sup.Actor which I created as "Test1" for instance) and then in a if conditional


if Sup.log(Sup.log(actor.getBehavior(MyCustomBehavior).CustomX) == Sup.log(Sup.log(EnemyActor?.getBehavior(MyCustomBehavior).CustomX) // Can the engine differentiate collisions and run these functions from each object?

{

let tempVar = Sup.log(actor.getBehavior(MyCustomBehavior).health);

actor.getBehavior().<custom_method>(param0, etc);


//Define method here>>>>>>???


//Or is the method a script that is loaded before this is run or after?

}


sorry for the newbie questions, Ive been learning programming but working with pre-built engine environments is just as confusing to me sometimes but is usually far less work which is why I am trying to learn to use everything I can. For instance game maker/unity work alot like this but still sometime confuses me.

(1 edit)

No, you don't need to use Sup.log! It was an example, to show how to do something concrete after getting a behavior (in this case, Sup.log displays a member variable's value in the browser's development tools, but you could be doing any number of things instead).

If you haven't already, looking at some of the demo projects might help: http://docs.sparklinlabs.com/en/resources/demo-pro... and https://bitbucket.org/sparklinlabs/profile/reposit...

Regarding collisions, there is a built-in axis-aligned bounding box collision system called ArcadePhysics2D. You can find a tutorial here: http://docs.sparklinlabs.com/en/tutorials/collisio...