compare at once

For questions about using Classic.

Post » Sat Aug 04, 2012 1:42 pm

Hi there,
I have an object and I want that when the mousex becomes greater than the object , add 10 to global('x').But when I want to do that it adds 10 while the program ends.I want to add just once.How shall I do that?
Thank you.
B
14
S
4
G
2
Posts: 91
Reputation: 2,390

Post » Sat Aug 04, 2012 3:30 pm

I'm not sure what you mean by "when the mousex becomes greater than the object," but I'll assume that you are comparing it to the object's X value. If you want the global('x') to be added just once, you might want to make another global numerical variable first. Let's call it 'Added' and let its initial value be zero. In your event, you have to check for 2 conditions: that mouse.x > object.x AND global('Added') = 0. You will then add 2 actions for that event. First, add 10 to global('x'). Next, set global('Added') to 1. This will guarantee that adding 10 to global('x') will occur once and only once if at all.
B
6
Posts: 27
Reputation: 404

Post » Sat Aug 04, 2012 6:47 pm

Thank you Elyzius!
That was really something I did want.
B
14
S
4
G
2
Posts: 91
Reputation: 2,390


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests