0 Favourites

How do I make my movement with inertia

  • Hello. I'm new to Construct.

    Tried to make their own movement. Allows you to move a sprite on the horizontal axis from left to right. This is not a problem. But I do not understand how to make a smooth change of direction (light inertia)?

    Inertia the same as in the standard platformer.

    Whatever the object was moving at a constant speed, but changed direction or stay smoothly.

    Please tell me how can I solve this problem without the use of behavior platformer.

    Sorry for my english

  • You could use lerp (linear interpolation) for this, but you could also program it yourself

    Create a global variable speed

    on right arrow down - sprite set x to sprite.x+speed

    add a subevent

    system compare variable speed is less than 10 - add 1 to speed

    on left arrow down - sprite set x to sprite.x+speed

    add a subevent

    system compare variable speed is more than -10 - subtract 1 from speed

    X on right arrow down (so inverted statement)

    X on left arrow down (so inverted stament)

    subevent

    system speed is between -10 and -1 - add 1 to speed

    system speed is between 1 and 10 - subtract 1 from speed

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Doesn't the 8Direction behavior already have settings for that, like acceleration, deceleration, etc?

  • Thank LittleStain, will experiment

    Was wondering how to make the controller without using a standard behavior

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