Basic sprite movement

0 favourites
  • 3 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • Probably a really easy one this but I've yet to implement anything with basic movement...

    On the title screen I have a character that starts off screen (at -50, 55) and walks on screen (to 15, 55).

    What events or behaviours etc do I need to implement this?

    Thanks all :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Depends on what you want this movement to look like.

    If you just need constant speed, you can do this without any behaviors:

    On every tick 
    Character X<15 : Character move N*dt pixels
    

    You can use lerp (very fast start, slows down as it gets closer to position):

    Character set X to lerp(self.x, 15, dt)

    Or try the new Tween behavior in C3 runtime, with it you can make different cool effects - acceleration, deceleration, bounce, etc.

  • You can use lerp in a different way as well to do the motion at a constant speed.

    You can do it with a t variable.

    Every tick
    — set t to min(1, t+dt/duation)
    — set x to lerp(startx, endx, t)
    — set y to lerp(starty, endy, t)

    It will move from a start position to an end position in “duration” seconds.

    Basically that’s what the easing behaviors do.

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