Playing with Phaser and accelerometer with gyro.js

Do you know gyro.js? gyro.js is an adaptor which combines all the current interfaces and standards on reading Gyro and Accelerometer information and combines them into one simple object.

I am testing it with Phaser and in a few lines I made a “tilt to move” prototype.

You can point your mobile browser to this link to test it, unfortunately with your desktop you won’t see anything but if you open the page with a mobile browser you should make it work, although it breaks when the device changes orientation.

But this is a problem you can solve when you port it to a native app.

This is the source code:

And here you can download the full source code, with all required libraries. Just a test, but maybe you can make something useful out of it

  • lived

    Because i didnt found any contact, i will write it here. I really like your website and i think it would be even better if it have some search field, so we can search for similar posts.

    • Emanuele Feronato

      you’re right, I am trying some stuff to better organize the content of the site

  • Hello,

    You can also check gyronorm.js here https://github.com/dorukeker/gyronorm.js
    Or FullTilt here: https://github.com/richtr/Full-Tilt

    They both give more accurate values across different devices and browsers.

    Cheers,
    Doruk

    • Emanuele Feronato

      Great! I’ll have a look at them