niubbone Posted April 28, 2010 Posted April 28, 2010 I wasn't able to find in forum and in help too. If I have a value let's say for a game, and let's call it $healt, then, how I set that variable minimum to for example 0 and maximum for example 100? Then during the game it will be modified but it must never go under 0 or over 100. I just control the $healt value modifying events with If or so (Like if $healt >=0 or <=100 then decrease it) or there is a way to make it value exceeding proof? For example i may want to put fights and i have 20 healt left, but my enemy hits me for 30. I want it to stop at 0 because I told before that the value of $healt must not go under 0 or over 100. Any clue? Also, If you suggest/know different method of doing the same thing, post here. Thanks community.
MrMitchell Posted April 28, 2010 Posted April 28, 2010 At key points throughout script or whenever necessary to check, you can do: If $healt < 0 Then $healt = 0 or If $healt > 100 Then $healt = 100 Something like that?
niubbone Posted April 28, 2010 Author Posted April 28, 2010 Yes that would work perfectly. Just wondering if there was a native function to state the thing when declaring a variable. Just asking to who knows more than me. Thanks, thats a good solution.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now