Hi I was wondering if there is a simple way to give a global or local variable a maximum number level.
E.g. I am creating a tower defence game where your core has 5 lives. but during the game its possible to earn more lives by getting highscores on certain levels. But I dont want the player to get more than 10 lives. So is there a simple event i can add to prevent the lives variable exceeding 10 or whatever amount is decided.
thank you.
Develop games in your browser. Powerful, performant & highly capable.
You can use clamp expression for that purpose.
For example:
If player overlaps cake then lives = clamp(lives+1, 0, 5)
See system expressions in the manual.