Jump to content

Define the min and max value of a variable


Recommended Posts

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...