Left & Right smooth Tilt(mobile) controls for Platformer

Get help using Construct 2

Post » Sun May 31, 2015 1:17 pm

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.
- Sashik
B
25
S
8
G
1
Posts: 13
Reputation: 3,037

Post » Sun May 31, 2015 3:45 pm

Touch.Gamma gives the tilt of the device, mess around with that. If you want to make it smoother look into interpolation.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Mon Jun 15, 2015 12:10 pm

briggybros, unfortunatelly your answer wasn't helpful.
- Sashik
B
25
S
8
G
1
Posts: 13
Reputation: 3,037

Post » Mon Jun 15, 2015 5:28 pm

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.
B
10
S
2
Posts: 109
Reputation: 982


Return to How do I....?

Who is online

Users browsing this forum: angryscientist, blackhornet, DarthPapalo666, Google [Bot], Yahoo [Bot] and 23 guests