i have 'variableA'
when variableA is '1' lerp is working
when '0' unlerp
i need set lerp from lerp(self.x, self.x +150, 0.1)
this function dont work because 'self.x+150' move sprite to infinity
i need solution how lerply move sprite from his original position to 150 forward but not more
Develop games in your browser. Powerful, performant & highly capable.
1. Store the destination in a variable and lerp to the variable.
2. Create an invisible object at the destination and lerp to the object.
oosyrag i will try first option
i make that
in instance variable of this sprite called 'lerpA' and 'lerpB +150'
on start of layout> set to lerpA to self.x so on started 'lerpA' store sprite position x
on start of layout> set to lerpB to self.leppA+150 so on started 'lerpB' store sprite position x +150
now when instance 'variableA' is 1
lerp(self.lerpA, self.lerpB, 0.1)
i expect this lerp should move position x 150 forward even if i change sprite position
anywhere on layout