Call an action or condition on a separate behavior.

For developers using the Construct 2 Javascript SDK

Post » Sat Jan 17, 2015 7:24 pm

Okay... so I have this object and it already has physics behavior applied to it. I created my own behavior, but I need to access information in physics behavior. I should think I should be able to simply say something like this.behaviorInstanceIWant.someCondition ... but I can't find it in the sdk.

In reality, I am basically writing controllers for physics objects. It seems like the sdk is usefull for making isolated behaviors but interactive ones seem much more difficult compared to other engines. Is this correct or am I missing something.

Thanks
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,163

Post » Sat Jan 24, 2015 11:19 pm

you're incorrect, behaviors have access to everything you'd need to write a controller. Calling specific conditions from the physics behavior is not how you'd go about it. you have to call the methods available to the instance / behaviour instance. if you wanted to write a behavior that runs events using conditions / actions / expressions, you're doing things wrong, you can do that in construct itself.
B
79
S
13
G
8
Posts: 1,976
Reputation: 9,947

Post » Mon May 02, 2016 7:51 pm

QuaziGNRLnose wrote:...if you wanted to write a behavior that runs events using conditions / actions / expressions, you're doing things wrong, you can do that in construct itself.



The reason I would do this is because a.) its still faster than the overhead of running c2 events, b.) I get sick of recreating events in project after project. I condense most of my events into behaviors and plugins because its easier to reuse them later than events are.

On the other hand I am curious, I must have missed this post last year, other wise I would have responded sooner lol, but how would one access the methods of a behavior on another object from within the object whose behavior is running, clearly that is probably better than accessing the aces, but idk... half the time the aces are already configured in such a way that a behavior script isn't very usable outside of those...

You would need the instance of the object being accessed, but im unclear as to how one actually calls the method on the behavior attached to that object?
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,163


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest