Left & Right smooth Tilt(mobile) controls for Platformer

0 favourites
  • 4 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • Hello, dear creators!

    Who can tell me how to make SMOOTH tilt control to left and right (more tilt, more speed.) for platform game. For example, like in DoodleJump or any SpaceShooter.

    Somebody please reply who have made Left & Right smooth mobile tilt controls. I'm so tired looking for such an easy solution.

    Thank you in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Touch.Gamma gives the tilt of the device, mess around with that. If you want to make it smoother look into interpolation.

  • briggybros, unfortunatelly your answer wasn't helpful.

  • Hi SashikLV,

    There could be two different controls, one would change the "Speed" with the tilt, while other would change the "X position" based on tilt, here is how you can implement both:

    For speed (assuming you already have a speed variable)

    Set Value (Speed) to Speed + Touch.Gamma

    if it is too sensitive and moving too fast, then make it Speed + Touch.Gamme/2 (divide by a number)

    if you wish to change the X position based on the amount of tilt then:

    Set X of Player to Player.X + Touch.Gamma*10 (multiply by a number to be able to reach both ends of the screen)

    I'm not sure about the multiplier or divide values, it depends on your game and Touch values, so you will have to experiment and fine-tune with some trial & errors. Good luck.

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