Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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.
Develop games in your browser. Powerful, performant & highly capable.
You can use clamp expression for that purpose.
If player overlaps cake then lives = clamp(lives+1, 0, 5)
See system expressions in the manual.