Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
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
Hello, I've today decided to make an item box that creates an object that gives the player HP. The only problem I am having is that out of 100 health points my player has (the item gives 50 hp), it over extends over 100 hp which shouldn't be possible as of yet in my game. So yeah, how do I add a limit on my variables?
This is how I do it, but there might be a better way.
HP is greater than or equal to 100 - Set to 100
(This is a compare variable condition)
Let me know if you need more clarification.
hp = min(100, hp + 50)
Develop games in your browser. Powerful, performant & highly capable.
This is how I do it, but there might be a better way. HP is greater than or equal to 100 - Set to 100 (This is a compare variable condition) Let me know if you need more clarification.
It worked perfectly, thank you!