# SOLVED From the position A to position B with Lerp

Get help using Construct 2

### » 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
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

### » 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
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

### » 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
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

### » 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

### » Thu May 17, 2012 7:38 am

oh my i forgot :)
B
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

### » Thu May 17, 2012 8:23 am

is it possible for you to post the code ? I'll be very interested in :)
B
21
S
9
G
4
Posts: 197
Reputation: 4,105

### » Thu May 17, 2012 3:12 pm

Yes, code of what?
B
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

### » Thu May 17, 2012 5:26 pm

I mean the .capx for this
B
21
S
9
G
4
Posts: 197
Reputation: 4,105

### » Thu May 17, 2012 7:48 pm

This is all:
B
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

### » Thu May 17, 2012 7:54 pm

Oh, that's it ? Lovely.
thank you :)
B
21
S
9
G
4
Posts: 197
Reputation: 4,105

Next