Behaviour Dependency

For developers using the Construct 2 Javascript SDK

Post » Wed Sep 19, 2012 2:29 pm

Hi all,

I'm looking at creating my first behaviour - dynamic squashing and stretching based on velocity.

As this is dependent on the physics behaviour, what is a the best way to access physics properties like VelocityX etc. ?

Thanks!
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Wed Sep 19, 2012 3:21 pm

There is no easy way to access it, and it changes depending on the behavior. Also, bear in mind changing the size of a Physics object will cause it to destroy the physics body and teleport in a new one of the new size (since it's the only way it's possible in a physics engine), and that can cause glitches.

The best thing to do is have a parameter in an action where the user passes a speed. Then it will work with all behaviors and any custom coded movements too.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Sep 19, 2012 4:46 pm

Thanks for the reply, that's very useful. In regards to changing the size of the physics object - I only want to change the sprite width/height, not the physics body itself. Is it possible to change sprite size without updating boundaries (circle collision)?
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests