My game currently has five actors evenly spaced apart from each other that move upward from the bottom of the screen to the top in a parallax fashion, kinda similar to the Tappy Chicken project. The actors reset to the bottom once they reach the top of the screen, and then move upward again forever in this loop.
The actors are also being sped up over time using a custom event tick I built that increases the play rate of each of their timelines, and once they reach a peak speed that I’ve set, their speed no longer increases.
Problem: The spacing between the actors tends to get thrown off over time and does not remain even between each of them. Actors slowly begin to overlap other actors.
Question: What is the best way to build this so that I can increase the speed of multiple parallaxing actors over time while also maintaining their spacing throughout gameplay?
You could just manually track the distance between the actors. If they start to get within Min Distance, force them back apart to their MinDistance. You can do the same for the MaxDistance they are apart. Just run with a Min/Max window to keep them inside based off your reference actor.
Lots of good suggestions here, thank you! I’m still really new to UE4 so I’m not exactly sure how to go about making these sorts of changes. I’ll try to explain my situation further.
As you know, I have five actors arranged vertically, spaced out evenly between each other and they each move upward on the screen using their own timelines.
The timelines are 5 seconds in duration, and I have each actor (not including the top actor) sitting on a 1, 2, 3, 4 second delay before their first ascent. This keeps them spaced out perfected for a little while - I have 5 actors, being animated over a 5 second duration, so that leaves a 1 second gap between each of them.
After they reach the top the first time, they just to go a reset location and begin again, rather than their initial starting point (they go to the “end of the line,” so to speak, on the bottom of the screen). As I mentioned, this is very similar to the way the Tappy Chicken project is setup.
I have a separate blueprint that has an event tick that sets the play rate of each of these timelines as the game is running. So they’re all being affected at the same time, at least that’s how it appears to be running.
And, over time, the actors start to slowly get closer to each other. Even though all of their play rates are being changed together, they’re slowly getting closer to each other.
I wish I knew a bit more about the engine, but I just picked it up only a month or two ago, so I’m still learning. I really appreciate the help. Thank you!!
I think I might know how to go about this method, but I’ll need to try some stuff out. I need to figure out how to get their distances from each other first, then determine the best time to check if they’re out of range of each other and set them back in range, all while they’re being moved by their own timelines.
They slowly get closer to eachother because they are going off the screen faster each time you increase their speed. If you always want to maintain a second of distance between them, then the following should work:
In your actor add a bool bIsLeader and default to false
When an actor goes off screen if it is bIsLeader let the GameMode know via a new event LeaderDied
When an actor goes off screen always destroy it
In the GameMode when LeaderDied is called spawn an actor and set bIsLeader to true then delay 1 second and call a 4 count long for loop that spawns an actor with a delay 1 second at the end.
On the Game Mode’s Post Begin Play go ahead and call LeaderDied to start off your crazy train of actors.
At least that’s who I would set it up off the top of my head, hope that helps! (I never looked at Tappy Chicken)