Behavior/Action Hierarchy

0 favourites
  • 4 posts
From the Asset Store
Alot of High Quality Items sound effects for your game!
  • Hi all,

    Can anyone explain the hierarchy of behaviors? When there are multiple behaviors on an object, does the order matter? I believe so. I've been trying to find doc on it. Also in some capxs that people have posted to the forums I've noticed people will use the Bullet behavior and then use Move at Angle action. So I assume normal actions supersede behaviors?

    For example I have bullet, rotate and pin on an object1. In my game I have the player on collision with object1 then object1 will be pinned to the player. It looks fine on my desktop, the object1 sticks to the player and but still rotates in place. However, when I run it on my laptop (a less powerful machine) I can see object1 sort of shaking, like it's the bullet behavior that is trying to make it go, but then is pin keeping it in place? and it just so happens on the less powerful machine I'm seeing a slowed down redraw rate which is exposing conflicting movements?

    anyone know more about this? thanks..

  • This post has the update order using SDK terminology:

    The order you have the behaviors is the order they run. The main exception is the pin behavior which isn't run till after the events. The following is the order things are run:

    run Behaviors

    run Events

    run Certain behaviors like pin are run here instead

    Draw

    Well it's actually a bit more complex than that when considering multiple object types and instances. You generally don't have any control which object type is run first. The order they're added define the order. Usually it doesn't matter though.

    For each object type

    For each instance

    For each behavior except pin

    --- run behavior

    run events

    For each object type

    For each instance

    For each pin behavior

    --- run behavior

    draw

    In the example you stated the pin behavior should correct object1's position before drawing, so you the bullet behavior shouldn't affect it.

  • thanks R0J0hound, actually I think it was one of your example capxs that inspired my question. I believe it was "GetBack.capx". You have bullet behavior on the 'badSprites' and then you do a For Each and depending on their distance to each other you do a "Move At Angle" on each of them which seems to override the bullet behavior?

    Re: my pin example, would the conflicting movement show on slower computers? or could there be a lag? On my laptop (i5 chip, 4GBram), the game is running at a lower fps and it looks like the bullet behavior starts to happen, but is then corrected by the pin. I can't be sure, but the sprite is definitely shaking (it's not super noticeable, but it made me wonder what was happening) and it does NOT do that on my desktop computer.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The events run after the behaviors so actions do override it. For the pin behavior even on a slow computer it should not jitter, because drawing still isn't done till the behaviors and events are done running.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)