hello everyone!
i am creating an idle game, (a game like cookie clicker) and i have a problem, how can i set values/variables so that they cant go negative ?
Add an event to make it so if a variable would go under zero, it makes it zero instead.
Or to the event which substracts the variable, add to the event that it can not be substracted if it it would go under 0.
Develop games in your browser. Powerful, performant & highly capable.
Add an event to make it so if a variable would go under zero, it makes it zero instead. Or to the event which substracts the variable, add to the event that it can not be substracted if it it would go under 0.
awesome idea! thanks !
Or use max()
[quote:t4aze1ii]
On click -> Set variable to max(variable - 1, 0)
max() sets a lower limit, so it will always return the higher value of the two