Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: ransu70 on August 12, 2013, 05:41:49 PM

Title: howto change max value to "0" - noob question
Post by: ransu70 on August 12, 2013, 05: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!

Title: Re: howto change max value to "0" - noob question
Post by: Horror on August 13, 2013, 07: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?
Title: Re: howto change max value to "0" - noob question
Post by: ransu70 on August 14, 2013, 06: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.