Jump to content

Accelerometer and lock orientation


Recommended Posts



Is it possible to contrive a game now controlled via the accelerometer?

In Phaser not included functions to work with the accelerometer, but what third-party solutions can be used together?


And the question about the orientation of the screens. Still now there is no way to lock the position of the desired game screen?



Link to comment
Share on other sites



there are some WebAPIs which could help.


First Screen Orientation Lock: https://developer.mozilla.org/en-US/docs/Web/API/Screen.lockOrientation

It's experimental but available at some Browsers/Devices. You could check the aspect ratio, too. Take a look at Richs mobile Template.


Second: There is a WebAPI for Device Orientation and Device Motion. But support is limited, too: https://developer.mozilla.org/en-US/docs/Web/API/Detecting_device_orientation


I've used Device Orientation and some other APIs for a #altctrl Jam entry this year: http://www.altctrlgamejam.com/games/541d471864ff4f2c5a10cc8e


The video shows, it works perfect on a FirefoxOS device. Everything is implemented with Phaser. Sources here: https://github.com/appsbu-de/ambilander


Maybe this helps a bit.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...