i’m making my first ue4 game, an endless runner game, and i made a power-up that works for 7 seconds and then stops, and I wanna make a progress bar that shows how much time is left, how do i do that?
You can set a timer to tick every .1 second and decrease the float variable by .1 each tick until it reaches zero, and divide this value by 7 to get the percentage
Or get a world time, add 7 to it and save it to variable, and then subtract the world time from that variable on tick to get the value.
Or even make a Timeline with curve that goes from 100 to 0 in 7 seconds and use in as progress bar percentage.
- or MapRange 0-7 seconds from the timer onto Progress Bar’s 0-1
- or, since this is widget, use widget animation that lasts 7 seconds