Jump to content

Accelerometer and lock orientation


Riddik
 Share

Recommended Posts

Hi!


 


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?


 


Thanks.


Link to comment
Share on other sites

Hi,

 

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

 Share

  • Recently Browsing   0 members

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