Enable/Disable Behaviour

New releases and general discussions.

Post » Tue May 25, 2010 12:06 pm

Is it possible to enable or disable a behaviour (such as platform movement) using an action (or perhaps script)?

I would like to have two movement behaviours on an object, but switch between the two at runtime.
B
1
G
2
Posts: 9
Reputation: 643

Post » Tue May 25, 2010 1:36 pm

Yeah, most of the behaviors have a "Set activated" action which enables/disables the behavior.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Tue May 25, 2010 2:10 pm

Ah yeah, found it. Thanks!
B
1
G
2
Posts: 9
Reputation: 643

Post » Tue May 25, 2010 4:11 pm

using 'Set Activated' is an option but using 'Ignore Input' is better because in many cases you want the sprite to get affected by the properties of the behavior like gravity etc. but don't want it to respond to user's input.

An example would be that suppose if you want to switch controls between 2 sprites with Platform behavior. If your one of the sprites is in mid air(jumping) and you disable it's platform behavior, it will hang in the mid air and the control will go to the other sprite.

Here is an example of ignore input.

http://dl.dropbox.com/u/5811650/Help%20 ... ntrols.cap
B
9
S
3
G
3
Posts: 366
Reputation: 2,301

Post » Wed May 26, 2010 8:28 am

[quote="abhilash2863":3q4s086r]using 'Set Activated' is an option but using 'Ignore Input' is better because in many cases you want the sprite to get affected by the properties of the behavior like gravity etc. but don't want it to respond to user's input.

An example would be that suppose if you want to switch controls between 2 sprites with Platform behavior. If your one of the sprites is in mid air(jumping) and you disable it's platform behavior, it will hang in the mid air and the control will go to the other sprite.

Here is an example of ignore input.

http://dl.dropbox.com/u/5811650/Help%20 ... ntrols.cap[/quote:3q4s086r]

While that is good for your example, its not very good if you have 2 movement behaviors on the same object as the OP said. If you have platform movement and physics behavior on the same object for example, and have both activated you will get weird results.
B
7
S
2
G
4
Posts: 164
Reputation: 2,418

Post » Wed May 26, 2010 9:31 am

[quote="Citnarf":35npd6fx]While that is good for your example, its not very good if you have 2 movement behaviors on the same object as the OP said. If you have platform movement and physics behavior on the same object for example, and have both activated you will get weird results.[/quote:35npd6fx]

I should read things more carefully :(
B
9
S
3
G
3
Posts: 366
Reputation: 2,301


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 1 guest