playMaker

Author Topic: howto change max value to "0" - noob question  (Read 1229 times)

ransu70

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
howto change max value to "0" - noob question
« on: August 12, 2013, 02:41:49 PM »
Hi! Just started with PM, and got stuck.
I have made an NGUI button that adds +1 to an integer (with IntAdd).
I have limited the value to be between 0-10 (with IntClamp)

but I would like the value to go to 0 from 10, when you press add +1 (at value 10).
And the same way back, if the value is 0, and you press subtract -1, the value sould go to 10.
How can I set it6 up to work like that?    Thx in advance!


Horror

  • Junior Playmaker
  • **
  • Posts: 79
    • View Profile
Re: howto change max value to "0" - noob question
« Reply #1 on: August 13, 2013, 04:29:25 AM »
You could just do an int compare on the variable after you add or subtract to it. If it's less than 0 then set it to 10; if it's greater than 10 then set it to 0. Unless there's some other way to make the value wrap?

ransu70

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
Re: howto change max value to "0" - noob question
« Reply #2 on: August 14, 2013, 03:30:37 PM »
THX! Horror

You helped me there to find the track. After testing a bit INT OPERATOR actually fits better my needs, but many thx. I start to get a little better grip of the system now.