Adding a distance traveled and a distance to go to my Endless Runner

Hi all,

I am fairly new to UE4 and have a basic prototype for an endless runner. I can collect coins, have different power-ups and increase the total points as I run further.

I have a print string telling me the distance traveled but I need a distance to go. This is because I want to add a boss fights to my game which are unlocked when you pass a certain distance.

I want it to look something like this!

I want the right value to change when you reach the distance. For example boss 1 will be at 100 meters and then boss fight 2 will be at 500 meters and so on. When you reach a boss fight the game will pause and the boss fight will commence a bit like Jetpack Joyrides SAM bot. I have the distances in a save file but i need help getting those numbers out of the array.

Another photo of the Save file with the values

I hope someone can other some advice.

Thanks in advance Gadget

Sorry its long

Just use a simple “Get” node on your array, when the player reaches the target distance “get” index 0. But use a variable for the getter this way at each “boss” distance you can increment the getter so that it will give you the next distance once you pass the first one. For example name a variable “Boss Index” make it an integer type. Then start the value at 0, plug it into the array of distances. This will return index 0, which should be your closest distance say 100m. Then when the player reaches this distance, spawn the boss and increment “boss index” to now be 0+1. Once the player finishes the first boss, the distance you “get” from the array will be index 1, so that will be 500m. etc etc

Thank you for your response!
I tried what you said and it solved my problem. Thank you.