How do I keep Count of My Coin Pick-ups? (Resolved)

Hi there, I’m having difficulty with implementing a counter for coins that are to be collected in my game. So far I have made the coin which rotates and destroys on overlap. I’ve also made it so when you “collect” the coin it prints a string to the screen, adding up the numbers each time. However, I’m looking for a counter that is fixed on the screen, looks nice and adds up each time with out disappearing like the string does.

Any help would be greatly appreciated.

My blue print so far-

What it looks like in game (as you can see string in top left under timer, would like the counter to be in same style as my timer)-

Hey there, so far so good, you coin counter is working. But you want to stop printing it, since printing is only for debugging.

Can you show me how you setup your timer? Is this a Canvas HUD Element or is it made with Widgets?

If it is made with widgets, then just add a second Text Field with the same layout settings as you Timer has and bind the Coin Value to the Text value.

You click on “Bind” and “Create Binding” near the Text OptionField at the right side of you widget:

http://puu.sh/eJy51/308773ce42.png

After that, you will be redirected to a function called something like “Get Text”.
It looks like this:

http://puu.sh/eJy5X/56bd8a0966.png

Then you can do something like that:

http://puu.sh/eJyct/a36d0ec5bd.png

This will keep the Text Variable uptodate with your Coin Counter.

Ah ok, you are using the normal HUD. I would recommend you to have a look at UMG and Widgets. There are tutorials on Youtube. It’s a bit easier to setup your HUD with UMG.

If you still want to stick to the old Canvas, then you can make a function called something like “DrawCoinCounter” and place it behind the “DrawTimer” function. Inside the function you can get the CoinCounter Value like i did in the picture, but instead of pluggin it in this “returnvalue” thing (that’s a widget function) you will want to plug in the CoinCounter Value inside the “Draw Text” function. The same way you did it with the HUD Timer values.

First of all thank you for replying so quickly! Greatly appreciated :slight_smile: I should have also mentioned that I am completely new to ue4 and blue prints etc. so bare with me If I seem a little confused.

As for the timer, here is a screen shot of the blue prints used. Maybe with these screen shots you could direct me on where to put your series of blue prints shown? :slight_smile:

Okay, I’ll give it a go! Thank you very much for your help :slight_smile:

Thank you sooooo much! Got it working exactly how I wanted it!! Looks the same as my timer and counts up perfectly! :slight_smile: Just need to work out how to make a score board now… haha

Here is what it looks like:

Nice, try to use UMG for the scoreboard or better for everything. I tell you it is so much easier to set things up as with the normal HUD Classes.

Alrighty, will have a look. Thanks again, saved me a massive head ache :slight_smile: