Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Global Lint on Wed 20/01/2010 18:10:34

Title: A Question about Global Integers.
Post by: Global Lint on Wed 20/01/2010 18:10:34
Hello all.

Imagine, if you will, a turn-based game with hit points as global int's.

The player has 60 hit points.
The enemy character performs an action that removes 100 hit points from the player's hp gauge.

If, in the script, the game was meant to 'end' (run a previously written 'game over' script) when the player's hp reached zero--

--would the global int become -40 or would it stop at zero to run the 'game over' script?

Just curious.
Title: Re: A Question about Global Integers.
Post by: Calin Leafshade on Wed 20/01/2010 18:13:12
the ints are signed so it would happily go into negative numbers.. Just check to see if it is less than 1 instead of zero.

or clamp the int when he loses the health in the first place.
Title: Re: A Question about Global Integers.
Post by: NsMn on Wed 20/01/2010 18:20:11
If it would check the points repeatedly and it isn't possible to, for example, get from 5 to -20 points, yes. But since that is probablynot the case, I'll just shut up.