Condition: "if not moving"

This forum is currently in read-only mode.
  • Is there an easy way to make a condition "if object is not moving"?

    The object has physics and is a sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Compare it's total velocity to 0.

  • Compare it's total velocity to 0.

    Thanks. I made a new condition, clicked the object, went to the "physics" tab, but didn't find any conditions: empty tab. Went to System, chose "compare". Entered "<object's name>." and searched in the auto-completion-list for "velocity", but didn't find "Velocity" there either.

    So I don't know how where to find the total velocity to compare.

  • I think most of the "movement" related behaviours should have a velocity property.

    Here's an example using the "custom movement" plugin.

    + System: Sprite[CustomMovement].Speed Equal to 0
    -> Text: Set text to "do a thing"
    [/code:2l3a9vac]
    
    This is using the "Compare Value" system command - it can be found at the bottom of the list of system actions. There are three parameter fields, specifically, the first value being compared, the comparison function (eg lesser than, greater than or equal to etc.) and the second value being compared. When entering the value in the first field, double clicking on the sprite's icon will give you a list of parameters and values. Clicking the "custom movement" tab at the top will give you properties specific to custom movement, one of which is "get speed".
    
    You can probably work the rest out from here.
  • Um, how about inverting the condition?

  • Thanks. Because of the custom movement example, I have found the velocity-option of the physics behaviour.

  • Keep in mind that there may be situations where an object may look to be stationary, but it's really moving with a small velocity (say, .2 pixels per second). I think with the physics behaviour, (and correct me if I'm wrong) a situation where a previously moving object is completely stopped could be rare.

    Considering this, having a range of speeds that are considered as "stopped" (say, less than 1 pixel per second, greater than 0) may provide better results.

  • Keep in mind that there may be situations where an object may look to be stationary, but it's really moving with a small velocity (say, .2 pixels per second). I think with the physics behaviour, (and correct me if I'm wrong) a situation where a previously moving object is completely stopped could be rare.

    Considering this, having a range of speeds that are considered as "stopped" (say, less than 1 pixel per second, greater than 0) may provide better results.

    Yeah, I noticed it!

    Thanks for the extra advice. Helpful again.

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