Hot to make my character move like in "Subway surfers"?

I want to make my character to move like in “Subway surfers”.If i press “A” it should dash left if i press “D” it should dash right if i press “S” it should slide.Please help me with the blueprints guys I am a begginer.

I would use a lerp node for the dashing movement. Then you can lerp the y value of the world location to the desired location of your character. you can use something like a timeline for the alpha value of the lerp node.
Do you understand what I’m trying to say or does it sound like gibberish? I could post an example if you want.

Ty very much for your time. I have managed to make it. And i have made it just the way you told me. Again thank you i apriciate your answer.

Hi Olverine,
I’m trying to figure out the same thing but could you elaborate on your answer please?

There are different ways you could do this. This is a pretty simple solution but there are different ways you could achieve this kind of movement. It really depends on how exactly you want it to behave and how clean you want your blueprint to look.

And here is the timeline:

You can change the speed of the transition by adjusting the length of the timeline (one second is actually a really long time).

The “Lane” variable determines what lane you are currently running in (counting from 0 in this example). The “newLane” variable determines what lane you are transitioning to. The “LaneY” variable is an array of float values that determines the actual y-value of the lanes. In this example, the transition is linear between the “Lane” and the “newLane”. You could also connect the y-value of the GetWorldLocation node to the A-value of the Lerp node. This would make an exponential (smoother looking) transition between the character location and the desired y-location.

If you have any questions or want any further explanation, please let me know. I’m happy to help!

Thank you, I’ll try it out!

Thank you Olverine, this worked for me. Just have to keep in mind that Array Lane is the actual position values for your object in world(Either x or y or Z). if you want to move your object in pitch (Y axis) make sure you have an array of (-100, 0, 100).

While this works perfectly for a straight line, if you build corners than the axes get all mixed up.

I spent 3 days trying to figure out a solution for this, came across something using the Get Actor Right Vector function, that one sort of works except it gives inconsistent results and the errors build up…anyway, I’m giving up

If anybody knows how to make this mind the pawn’s rotation, give me a sign. until then, I’m giving up on corner functionality for a lane-based runner and finally moving on with my life.

Cheers!

I’ve tried doing the exact same thing in UE 4.15, but after I pressed A/D, the game just went to first person view to the left lane and then falls off the tile.

This should probably have been a comment since it doesn’t answer the question :wink:

Anyways, the reason your character only jumps between two lanes is because you have only defined two lanes in your “Lane Y” array. You need to define y values for every lane.

I do not know however, why the transition isn’t smooth. Maybe I could answer that if you showed me your timeline.

Hi Olverine,

I’ve tried a lot of different approaches for this. I’m making a 4 lane endless runner on version 4.13.

I’m trying to move my character left and right smoothly like in subway surfer.

I tried you blue print but my character seems to only teleport and only to two planes. Not sure what I’m missing.

Thanks.

Fixed :slight_smile:

Another thing when I press left arrow I move right, and when I hit right I still move right.

I think I may have my “Lane Y” array backwards. Honestly the things I want to be able to change easily is the direction in which I step, how far I can step and the time/speed it takes to make that step.

The first point on the timeline is time: 0 and value: 0.

Thanks again.

Happy New Year!

This is the closest I’ve gotten to it. The only thing is it’s not consistent.

Any ideas on why step event 1 screenshot is not working?

Thanks.

Any fixes? All it does is move me off to the right no matter which button I press.

Thanks.

So I did it but I get this error:

Blueprint Runtime Error: Attempted to access index 2 from array Lane Y of length 2! from function: ‘ExecuteUbergraph_RunCharacter’ from node: SetActorLocation in graph: EventGraph in object: RunCharacter with description: Attempted to access index 2 from array Lane Y of length 2!

that error means your attempting to get a value that is not set yet, basically there are two entries in the array and your getting the third. length 2 means theres indexes 0 and 1, and your attempting to get index 2.