0 Favourites

How do I control player animation smoothly with tilt

  • In the infinite jumper template i added a mirrored/ not mirrored animation to the Touch gamma events. It does what it's supposed to do, but the animation jerks too much.

    If the tilt is barely a few degrees either way, the player's animation jumps left to right or vice versa erratically. Anyway to calm this down a bit and make it a bit smoother?

    Thanks for any input with this.

  • It sounds like the mirrored is what is causing the jerking—is the origin in the middle of the sprite?

    I assume the mirroring is done from the origin, so the closer the origin is to the center of the sprite the smoother the toggling of the mirroring should be.

  • Thanks for reply, badmoodtaylor

    Yes, the origin is in the correct place.

    When jumping, if you tilt just a small fraction it's like he can't decide which way to go. Like he's shaking from left to right.

    I was thinking it has to do with the gamma numbers, but if i increase them too much he becomes sluggish.

  • You should consider to have a dead zone like on gamepad.

    I guess you are having your animation change action happen if the tilt is between value A and value B.

    Make sure that A is further from 0 (or from the origin value) to prevent the animation change to happen too often (the player has to tilt the device intentionally in a specific direction).

    Add such an offset in the other direction as well, and possibly to any other direction you would need.

  • What type of movement behavior? How do you have it setup/what are your events?

    Consider posting screenshot of what is happening and/or your events so it is easier to help you.

  • Thanks for the tip, Kyatric i'll check that out.

    badmoodtaylor i am using the infinite jumper demo. Everything is the same except i added mirrored/ not mirrored animation to the Touch Events with the gamma logic... simulate pressing left - set mirrored...

    Oh, i did increase the numbers from -8, 8 to -10, 10.

    That and i added a scoring system.

    Nothing much more than that.

  • But I'm still not sure what this means exactly:

    ... the animation jerks too much.

    This is your original question/problem and it is still unclear. That's why I suggest posting an animated gif of it—probably easier to see than describe.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • And if it is the 'animation' jerking too much, not the sprite's location, I would still think it has to do with the origin. Did you check the origin on every frame of the animation?

  • badmoontaylor

    There are only 2 frames, frame 1 is landed, frame 2 is jumping.

    Sensitivity that's what it is. If you look in the infinite jumper demo- at the touch > gamma events. That sprite only has 1 frame. But if you mirror it on left and not mirror it on right you'll see what i mean.

  • After looking at similar games, i think the problem may be with the platform speeds: speed, acceleration...

    Have to mess around with it.

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