How to transfer the last known value of a looping variable to other variable?
hello i have been making a 2d sidescroller game and stuck at a point where i need the total distance travel to show player their scores but i cant take the value to distance traveled because it is constantly looping and when player dies the value of other variable becomes zero. The variables are shown in image:- 1. total distance traveled - The one who's value is needed. 2. run - The one in which the distance value will be set.
asked Mar 28 '17 at 08:12 AM in Blueprint Scripting
I do not really understand what variables of yours have valid values and which don't right now, but here is what I would do: Take the PlayerSpeed variable you have, and add it to the TotalDistanceTravelled * TimeDelta in your tick function. This should set the value of TotalDistanceTravelled correctly.
answered Mar 28 '17 at 08:32 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here