How do I make a coin, hitpoints, and flowerpoints counter?

Just started using Construct 2? Post your questions here

Post » Mon Jun 26, 2017 1:50 am more thing, and I'm sorry I'm asking you so many questions, can you explain what you just did so I can do that for other things?
Posts: 11
Reputation: 572

Post » Mon Jun 26, 2017 1:53 am

Well if I was to say do it a certain way, I would say scrap that local variable on font object. When you change to a new layout later on it will cause problems. The best way to do player health is to use a global variable and reference it. The variable is a value that is always there and changing. For the display of it, you are just referencing that value, so in this case the health is HPFont.currenthealth / HPFont.maxhealth. You should use a global variable so you dont need to reference an object, so playerHealth / 5 will do! It's just about getting familiar with the C2 basics. In terms of the actual text event, you separate bits out with an & symbol.

To break it down even further so you have an understanding and can then go on to do it with the flower points. You store values such as health and items collected as a variable. They are always there in the background and changing, you can add and subtract from them. You can use a text object to display text, but also to display these variable values that are constantly changing during gameplay. Using SetText you can set the text to show a variable such as health. Every Tick is used to update the values constantly during the gameplay.

Edit: if you check the link again, I've done this. I changed it to global health and coins for you.
Posts: 2,341
Reputation: 52,693


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest