SOLVED From the position A to position B with Lerp

Get help using Construct 2

Post » Wed May 16, 2012 11:03 pm

I use when 'is in touch' go to position- lerp(touch.X,0,0.01) and lerp(touch.Y,0,0.01) but my character are 'teleported' to this place only, not smoothlydelgado2012-05-17 07:39:02
B
103
S
25
G
40
Posts: 1,876
Reputation: 31,885

Post » Wed May 16, 2012 11:28 pm

What happens when you say set x to x + 1?

Also:
You might think of it terms of lerp(start, end, percentage)
Where the percentage is expressed in terms of 1 to 0.00, and 1 is 100 percent.
In this case the percentage is not as important as what is changing in the start. The percentage is the time element, usually expressed using delta time.
lerp(self.x, touch.x, 1*dt)
In this equation self.x is always changing, and so does touch.x, if you move the touch, but self.x only goes to a percentage of the distance between self.x, and touch.y, as long a the percent is within the range of 1 to 0.00.newt2012-05-16 23:46:53
Image ImageImage
B
164
S
49
G
139
Posts: 7,966
Reputation: 92,398

Post » Thu May 17, 2012 7:14 am

Yes, now its working fine ! But i have another question. My character follow perfectly to touch position but i want to character always back to 'start position' when im not touching screen. This is no option like'is not touching' do something. How handle this?
B
103
S
25
G
40
Posts: 1,876
Reputation: 31,885

Post » Thu May 17, 2012 7:37 am

Invert the "is touching" condition. ;) (Right click the condition and you'll see it)Mipey2012-05-17 07:37:58
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu May 17, 2012 7:38 am

oh my i forgot :)
B
103
S
25
G
40
Posts: 1,876
Reputation: 31,885

Post » Thu May 17, 2012 8:23 am

Hello Delgado,
is it possible for you to post the code ? I'll be very interested in :)
B
28
S
12
G
5
Posts: 218
Reputation: 5,162

Post » Thu May 17, 2012 3:12 pm

Yes, code of what?
B
103
S
25
G
40
Posts: 1,876
Reputation: 31,885

Post » Thu May 17, 2012 5:26 pm

I mean the .capx for this
B
28
S
12
G
5
Posts: 218
Reputation: 5,162

Post » Thu May 17, 2012 7:48 pm

This is all:
B
103
S
25
G
40
Posts: 1,876
Reputation: 31,885

Post » Thu May 17, 2012 7:54 pm

Oh, that's it ? Lovely.
thank you :)
B
28
S
12
G
5
Posts: 218
Reputation: 5,162

Next

Return to How do I....?

Who is online

Users browsing this forum: irwandwiyanto, matrixreal and 8 guests