SOLVED From the position A to position B with Lerp

Forum Home Forum Home > Construct 2 General > How do I....?
 Post Reply Post Reply
Author
8,503 Rep
Post Options Post Options   Quote delgado Quote  Post ReplyReply Direct Link To This Post Topic: SOLVED From the position A to position B with Lerp
    Posted: 16 May 2012 at 11:03pm
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 smoothly

Edited by delgado - 17 May 2012 at 7:39am
Scirra tools are so COOL!
Back to Top
16,524 Rep
Post Options Post Options   Quote newt Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2012 at 11:28pm
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.

Edited by newt - 16 May 2012 at 11:46pm
Back to Top
8,503 Rep
Post Options Post Options   Quote delgado Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2012 at 7:14am
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?
Scirra tools are so COOL!
Back to Top
10,193 Rep
Post Options Post Options   Quote Mipey Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2012 at 7:37am
Invert the "is touching" condition. ;) (Right click the condition and you'll see it)

Edited by Mipey - 17 May 2012 at 7:37am
Back to Top
8,503 Rep
Post Options Post Options   Quote delgado Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2012 at 7:38am
oh my i forgot :)
Scirra tools are so COOL!
Back to Top
1,533 Rep
Post Options Post Options   Quote Laurent Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2012 at 8:23am
Hello Delgado,
is it possible for you to post the code ? I'll be very interested in :)
Back to Top
8,503 Rep
Post Options Post Options   Quote delgado Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2012 at 3:12pm
Yes, code of what?
Scirra tools are so COOL!
Back to Top
1,533 Rep
Post Options Post Options   Quote Laurent Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2012 at 5:26pm
I mean the .capx for this
Back to Top
8,503 Rep
Post Options Post Options   Quote delgado Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2012 at 7:48pm
This is all:
Scirra tools are so COOL!
Back to Top
1,533 Rep
Post Options Post Options   Quote Laurent Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2012 at 7:54pm
Oh, that's it ? Lovely.
thank you :)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down