How to loop back a interger

  • I've made a mini game where you have to switch through a selection of symbols (that are the individual frames of a sprite) through clicking on arrows on screen. The way I have it set up is that the arrows add or subtract a global variable which affects which frame the object shows to a total of 10 frames (0-9), when adding the value if it's 9 and I click it it sets it back to 0 but when subtracting if it's 0 then when clicked sets the value to 9. Adding up works as intended, but it's when subtracting that it doesn't, yes it sets the value to 9, but the next click sets it to -2 and then it keeps going negative. What am I doing wrong here?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Never mind, turned out the problem was that there was no other condition for when Var=9 and click, so yes the subtraction would get confused. Added a second condition and fixed my problem! Moral of the story, double check your conditions and events.

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