Limit index value

hiddevandijkhiddevandijk Member Posts: 17
edited October 2013 in Working with GS (Mac)
Hi there,

Is there any way I can limit an game attributes index value between min 0 and max 3. As this is an index, the 0 van never become a -1, so this is easy.

This is how I want it to work:

Swipe right, change game.SwipeIndex to game.SwipeIndex+1 (with a maximum capped value of 3)
Swipe left, change game.SwipeIndex to game.SwipeIndex-1 (with a minimum capped value of 0)

Thanks for any help.

Hidde.

Comments

  • hiddevandijkhiddevandijk Member Posts: 17
    Got it. I feel a bit stupid. Forgot the extra brackets:

    for max, set the formula like this:

    min(3,( game.SwipeIndex +1))

    Hope this helps anyone else.
  • hiddevandijkhiddevandijk Member Posts: 17
    Can admin close this one for me, as I cannot set it to answered myself :)
Sign In or Register to comment.