Condition: "if not moving"

For questions about using Classic.

Post » Wed Jan 06, 2010 10:46 am

Is there an easy way to make a condition "if object is not moving"?
The object has physics and is a sprite.
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Wed Jan 06, 2010 10:53 am

Compare it's total velocity to 0.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Jan 06, 2010 11:00 am

[quote="deadeye":5ifv5tqe]Compare it's total velocity to 0.[/quote:5ifv5tqe]

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. :)
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Wed Jan 06, 2010 12:53 pm

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

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

[code:2l3a9vac]+ 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.
B
3
G
3
Posts: 46
Reputation: 967

Post » Wed Jan 06, 2010 1:27 pm

Um, how about inverting the condition?
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Wed Jan 06, 2010 3:03 pm

Thanks. Because of the custom movement example, I have found the velocity-option of the physics behaviour.
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Wed Jan 06, 2010 3:44 pm

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.
B
3
G
3
Posts: 46
Reputation: 967

Post » Wed Jan 06, 2010 4:14 pm

[quote="Stargoat":fz91ggaw]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.[/quote:fz91ggaw]

Yeah, I noticed it! :)
Thanks for the extra advice. Helpful again.
B
16
S
5
G
7
Posts: 599
Reputation: 5,000


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests