How can i move sprite smoothly using lerp?

0 favourites
  • 10 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hi everyone

    I want to move a sprite from A to B smoothly using lerp and without Variables.

    Can i make this?

    Thank's for any help.

  • Well if you want the object to move after a click, you got to have some vars.

    If you want it to follow the mouse/touch you can do it without vars.

    check this out:

    [attachment=0:2o1vf4u4][/attachment:2o1vf4u4]

  • Thank's for the capx.

    What i want is when i click a button the sprite go from Position X to Position X2, i think can be done without var.

  • Does Lof's capx not answer your question? and I'm curious, why avoid variables?

    can you take what Lof did (the one without the variables) and plug in your positions instead of the touch positions?

  • I am not an expert, but i am not sure you can and i don't see what's the problem with storing the values?

    Lerp is not an action that runs once, you run it every tick and the object keeps moving until it reaches point B.

    So you must have access to point B .X .Y all the way through, when you click you get the .X .Y but it's not stored anywhere.

  • Well, it sounds like his point B is a constant anyway, so that shouldn't matter, right? If I'm not misunderstanding, he knows what two points he wants, and just wants to move between them on the click of a button.

    EDIT: So like this, I'm thinking:

    [attachment=0:14i9em1e][/attachment:14i9em1e]

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If that's the case and it's a one time movement to a predefined point B, than yes.

  • Now that i think of it, you will still need a var for triggering the movement, unless you hold your click/touch.

    Or grouping may also work

  • I added a capx to my post earlier, I did it with grouping. heh..

  • Thank's guys for the help and the capx.

    I don't want to use Var because i have already lot of it.

    I hope some day the custom movement behavior will be improved so we can move sprites to target positions.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)