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
119
S
32
G
53
Posts: 1,896
Reputation: 39,569

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
60
S
30
G
132
Posts: 1,931
Reputation: 74,339

Post » Mon Mar 07, 2016 10:38 am

@oosyrag i will try first option
B
119
S
32
G
53
Posts: 1,896
Reputation: 39,569

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
119
S
32
G
53
Posts: 1,896
Reputation: 39,569


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests