compound object

For developers using the Construct 2 Javascript SDK

Post » Fri Jan 16, 2015 6:13 pm

Hey fellow devs,

I had a quick question. would it be possible to create a behavior that affects more than just the object tied to it? I want to make a behavior that creates additional objects to function as collision and pickup boxes. I'm tired of setting this up in project after project when it is the same thing.

The behavior would also affect other behaviors such as physics in post tick.

I just need to know if a behavior can do this before I start figuring out the hows...
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Fri Jan 16, 2015 6:49 pm

You can acess the instance the behaviour is tied to with this.inst i think. If you have refrences to those other objects (for instance through uid, or just from some js ref, or previously stored through some picking condition) theres no reason you cant code the behaviour to affect both. I think pin behaviour does this sort of thing. You can create new objects with runtime.createinstance or something like that, then store refs to those in the behaviour, and do as you please with them.
B
77
S
13
G
8
Posts: 1,974
Reputation: 9,893

Post » Sat Jan 17, 2015 6:59 am

@quaziGNRLnose Thanks, I didn't think about pin referencing another object. It's funny, this sort of thing is super easy to make in something like unity, but I have so much trouble coding for construct.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Sun Jan 18, 2015 6:46 am

Its not really hard, just different.
B
77
S
13
G
8
Posts: 1,974
Reputation: 9,893

Post » Mon Jan 19, 2015 10:27 pm

@QuaziGNRLnose - It turns out, Ashely said that is a very bad idea... I'm not sure why, just that construct 2 wasn't designed that way. Basically, calling a condition or action of another behavior (even on the same object) from a second behavior doesn't work. I asked for clarification but haven't heard back... I can't even find/remember what post it was in
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Tue Jan 20, 2015 12:26 am

B
108
S
26
G
272
Posts: 4,471
Reputation: 152,277

Post » Tue Jan 20, 2015 1:42 am

@rexrainbow - Oh my goodness, where have you been my whole life! this website is a gold mine!

So then, nothing bad happens when you call a behaviors action and don't use the event sheet to call it?

...and it works with a behavior and not just a plugin?
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Tue Jan 20, 2015 2:12 am

@ruskul

Most of ACE reusing had no side effect, but I could not promise for all cases.
And yes, it works with behavior and plugin.
B
108
S
26
G
272
Posts: 4,471
Reputation: 152,277

Post » Tue Jan 20, 2015 2:19 am

@rexrainbow - I noticed that on your blog the zip file for pid tourque was broken. I also could not find it on the forums here. Is it that supposed to be the case?

It seemed to be doing something similar to what I wanted but I couldn't open it/ unzip it
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Tue Jan 20, 2015 2:32 am

B
108
S
26
G
272
Posts: 4,471
Reputation: 152,277

Next

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest