Looking for solution to lerp function

Get help using Construct 2

Post » Mon Mar 07, 2016 2:44 am

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
B
111
S
28
G
48
Posts: 1,882
Reputation: 36,428

Post » Mon Mar 07, 2016 4:56 am

Either -

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.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,698
Reputation: 64,444

Post » Mon Mar 07, 2016 10:38 am

@oosyrag i will try first option
B
111
S
28
G
48
Posts: 1,882
Reputation: 36,428

Post » Mon Mar 07, 2016 11:03 am

hmm
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
and
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
B
111
S
28
G
48
Posts: 1,882
Reputation: 36,428


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests