How to do tilt controls for html and Js game

821 views Asked by At

I have this mobile game I made, and I’m wondering if you can access the gyroscope or accelerometer of a mobile device to move a character. Basically, I want the user to be able to tilt his device like a steering wheel to move a character. I don’t really have any code to show, although I have tried these websites solutions: https://www.dummies.com/programming/programming-games/how-to-add-tilt-controls-to-your-html5-game/

How to access accelerometer/gyroscope data from Javascript?

They haven’t worked for me? So is there any idea how to?

0

There are 0 answers