Temple Run-like game - Character movement problem

Hi all, I’m trying to make a “Temple Run” like game.
the character is set to move forward on “Event Tick” so it’s constantly moving forward.

I want the character to move 850 units to the right by pressing D and -850 by pressing A

This is my setup:

The setup for “A” key works fine, it moves the character by -850 units as I want to, however there is a sudden jump.

I thought I could solve this issue by creating a timeline so the value changes throughout a given time, however when I do it with the time line, (even though I don’t get the sudden jump) the character jumps to the right waaaaay too much!
and if i set a similar set up for “A”, then the characters movement to the left and right is not on equal amounts.

For example, if both A & D have the same set up with the timeline, if the character’s Y position is 0 and I press D, the character moves to the right by (from what I see) a random number, and when I press A, the character does not go back to 0, it goes to another random number.

Any ideas?


You can just use an fInterp to go from the current value up to the 850 units that you want, bit easier than a timeline. You should also try debugging and printing out your values of location so you can see how much it’s moving and where, makes it easier for you to figure out exactly what its doing.

Also you don’t need a DoOnce node after the pressed since it doesn’t repeat itself when held down, so it has the DoOnce built into itself already.

ZoltanJr, it’s not working :frowning:

You should probably try explain what is not working with each of those instances. Im pretty sure print stringing or putting a breakpoint and inspecting the values will always work 100% of the time.