compare at once

This forum is currently in read-only mode.
  • 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you Elyzius!

    That was really something I did want.

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