How to show multiple instances of a variable(scores) for a short amount of time, during the same time.
Sorry for the title, and my englando.
Im doing a scoring system for my game. SO far I have a totalScore variable that stores the total score of the player (duh). And a addPoints that stores the amount of point a player gets when triggering stuff; finishing a mission, colliding in objects that gives points.
So system is a UMG widget with binded variables to show the scores and points.
What I need it to do: I need it to not just show the current addPoints value, but when addPoints gets changed it will show that value for a set amount of time (lets say 3s), and if during that time, addPoints get updated again it will show another instances of the variable(with the other value) for the same amount of time (3s). And after the time is up for the instance it dissapears.
I hope you can help me, cuz I really cant figure this one out, thanks. <3
asked Oct 05 '16 at 06:19 AM in Blueprint Scripting
I think I understand what you mean. You want something like a message log that automatically fills up with the new added scores and clears out if no score is added for a few seconds?
In that case, what I would do is have a UMG widget called ScoreList with an empty vertical box marked as a variable, and whenever the player triggers something that gives him score, call a function in ScoreList which spawns another widget blueprint, let's call it ScoreRow, and adds it into the ScoreList vertical box. ScoreRow would have a text with the points added, and on beginplay it would play a FadeIn (or SlideIn might look nice) animation, delay 3 seconds, then play that FadeIn backwards, delay for 1 second more and then RemoveFromParent. You can use the pivot location on the ScoreList to determine which way the list should grow, if newer rows should be fixed on the bottom or be placed underneath the existing ones etc. If you want the newer ones to be on top, I think there should be a way to specify exactly where in the list the new row should be added (it should be added as the first child in that case).
Follow this question
Once you sign in you will be able to subscribe for any updates here