image

Emanuele Feronato writes:

"When you design an HTML5 game to be played on smartphones, unfortunately you can’t lock the orientation, so if the players are playing your game with the wrong orientation, you have to tell them to change orientation. This is quite easy, until you are making a responsive game which uses every single pixel of your device browser window.

The following example, made with Phaser, will show you how to lock orientation in a portrait responsive HTML5 game."

Read the full tutorial

Editors note: The technique used in this tutorial is fine and worth learning. However mobile devices are opening up native orientation locking without the need for "Please rotate" screens. This is already available in Chrome on Android: See for more details.