[Question] I can't find this anywhere... Displaying player's extra lives as image(s) in UMG?
I'm developing a game and have been really sinking my teeth into the health/damage/death/lives logic this week. Everything is set up in terms of health and damage, health bars are working, attacks are working, etc. I just cannot, for the life of me, figure out how to display the number of extra lives a player currently has as an image or multiple images in a corner of the screen.
Here's a probably-entirely-unhelpful screengrab of my Widget currently. Health bar works, image doesn't draw to screen.
If someone could point me to the proper documentation, youtube tutorial, Learn Tab project, or even a particular setting that might get me going in the right direction, it would be much appreciated.
Posted Feb 22, 2016, 6:04 PM UTC
The image should draw by default as you have it configured. However, the anchor appears to be located incorrectly - you'll probably get better results if you change the anchor to the bottom left corner.
The other deciding factor here is that you have a function bound to the brush. What is in that function? Your real answer is most likely in there.
The function is garbage, I was trying to use it to find int_P_lives, but unsuccessfully.
Well that function will overwrite the properties of the brush component it's bound to. Unless you're setting the image of that brush inside that function, it will end up returning an empty brush and nothing will appear on your screen.
If it's garbage, you should unbind it from the component.
Did so, and that's working, but it just draws an image no matter what the condition of int P_lives. Which makes sense, because there's no reference to the lives integer. Just need to know where to reference that to make it draw multiple images depending on the INT value.
What I'd do is create a slate brush variable in your widget, and then set this variable to update your widget using the bound function.
Now, wherever you're setting P_lives, you can do a switch on int and update the slate brush variable in your widget to whatever image you need it to be.