Book Image

HTML5 Game Development Hotshot

By : Seng Hin Mak, Makzan Makzan (Mak Seng Hin)
Book Image

HTML5 Game Development Hotshot

By: Seng Hin Mak, Makzan Makzan (Mak Seng Hin)

Overview of this book

Table of Contents (15 chapters)
HTML5 Game Development HOTSHOT
About the Author
About the Reviewers

Making the game mobile friendly

Making a game work on a mobile platform is not only about the screen resolution, but also about changing from a mouse cursor input to touches and a lot of performance tuning. In this task, we make the game work better on mobile phones by providing touch screen support.

Prepare for lift off

When we publish the game on the Web, we can have several settings to enhance the experience when playing on a mobile touch device. We add the following launch screen and app icon to the images folder:

We need another library to help improve the clicking events on a DOM element in mobile devices. It eliminates a clicking delay that is added by the mobile platform. We will discuss the delay later. Download the fastclick.js file from and add it to the vendors folder. Make sure we import this file in the index.html file.

Engage thrusters

  1. First, we enable the touch event for the customer view:

    cjs.Touch.enable(game.stage, /*single touch=*/ true,...