0 Favourites

Can I make smooth animation ?

  • Hi.

    At this moment, I'm moving my character using the simple way

    player.X = player.X + 64 ( :v ) so, the player jumps instandly to the next position

    I want to know if it is possible to make that movement smooth, like a transition (?)

    I read about lerp, but I don't know if I can use it in this case or if there is a different way to make it.

    Thanks you all.

  • Yes you can use lerp also.

    lerp works kind of like this.

    lerp(sprite.startposition, sprite.endposition, 0.1)

    0.1 is 10% of the distance per tick.

    You can also try a plugin called liteTween you can find it here on the forums. It can do similar a thing but with much more nice acceleration and smooth movement. Highly recommended, as lerp is only linear.

  • Yes you can use lerp also.

    lerp works kind of like this.

    lerp(sprite.startposition, sprite.endposition, 0.1)

    0.1 is 10% of the distance per tick.

    You can also try a plugin called liteTween you can find it here on the forums. It can do similar a thing but with much more nice acceleration and smooth movement. Highly recommended, as lerp is only linear.

    Thanks for responding tunepunk

    The problem is:

    It is a loop who moves the character, like this

    so, if it is 1 - move the player right, if it's 2 - move the player left and the same for up and down

    that's why I need to use a "wait" there, in the loop.

    I used lerp, following what you said but the character barely moves.

    I don't know what to do, even if it is possible into a loop

  • Why would you do this in a loop ?

    Are you aware that the events already run in a 'big' loop ?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Why would you do this in a loop ?

    Are you aware that the events already run in a 'big' loop ?

    I know, I know

    But I need the real player selects his movements first i.e

    The player wants to go right, right, down and right, so he will select those movements from a list and when he finishes, presses play and the character Will move according those selected movements?

    I had to do that because someone else needs it that way

  • I'm not really sure what you are trying to do with the looping, but maybe it's better if you just set a variable in the loop, and do the ectuap movement outside the loop when that variable is set.

  • Ah ok. One of the many ways.

    https://www.dropbox.com/s/yx2fmprpiqdqy ... .capx?dl=0

    Using the MoveTo plugin, behavior-moveto_t63156

    I was a bit done with all the lerping 2day.

    As you see. You can not lock the interactivity of the player up in a loop. And you can not lock this moving (that takes time) up in a loop. A loop happens in the same tick. This movement happens over several ticks.

    Normally i wouldo this with instances of the same sprite for the player, but i feel that you learn more of it (for now) if i use two different sprites.

    Have fun coding.

  • Ah ok. One of the many ways.

    https://www.dropbox.com/s/yx2fmprpiqdqy ... .capx?dl=0

    Using the MoveTo plugin, behavior-moveto_t63156

    I was a bit done with all the lerping 2day.

    As you see. You can not lock the interactivity of the player up in a loop. And you can not lock this moving (that takes time) up in a loop. A loop happens in the same tick. This movement happens over several ticks.

    Normally i wouldo this with instances of the same sprite for the player, but i feel that you learn more of it (for now) if i use two different sprites.

    Have fun coding.

    thank you

    I am going to try

    I'm new with this so, I'm doing my best <img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
1,941 263,366
FlyingRam's avatar
FlyingRam
Unread hot topic
167 14,516
DMT2005's avatar
DMT2005
Unread sticky
1 Favourites
C2 Games made with CocoonIO
136 89,841
minhcuong's avatar
minhcuong