Download

Endless Runner-Keep Player in Lane

Hello everyone,
I’m working on an endless runner game and I’m trying to implement a functionality which keeps the player in lane along the spawned floor tiles. I want to have 3 lanes in which the player can run along, so the simplest way to implement something like this would be to to move the player a constant amount to the left when presing a button to move left if he isn’t already on the left lane and the same for the right. However this would only work if my game has straight floor tiles. But I want to have slightly curved floor tiles, too without getting the player out of the lane. For example:

The only solution which I could think of was to do it with a spline.
I have seen a tutorial how to make the player following a spline https://forums.unrealengine.com/showthread.php?24522-Tutorial-Blueprint-Spline-locked-sidescroller-%28e-g-Klonoa-Pandemonium-style-game%29&highlight=spline and I think I would be able to make it possible to let the player move left and right along the spline, but the problem is since the endless runner game has a random generated course there cannot be one long spline along the course, but many short splines. In fact one spline for each floor tile and the problem is that I don’t know how to connect them. I hope someone can help me solving this problem or knows probably a even easier solution :slight_smile:

Thanks in advance

I would like to know this, too.