Godot Version
v4.2.2.stable.arch_linux
Question
I’m trying to make a subways surfers styled game, and i’ve gotten to a point where i’m overthinking things. Currently, the code that i know pertains to the situation im having looks like this:
var positions: Array = [-3,0,3]
var curPos = 1
func _process(delta):
swipe()
if swipeDir == 1:
if curPos < 2:
curPos += 1
position.x = positions[curPos]
swipeDir = 0
elif swipeDir == -1:
if curPos > 0:
curPos -= 1
position.x = positions[curPos]
swipeDir = 0
I for the life of me cant figure out how to move it using lerp. I know i have to change the position.x = positions[curPos] to use lerp or interpolation, but everything I try ends up erroring out.