Chapter 5

Event Handling and User Input

This chapter is devoted to several important topics: handling user input, implementing custom event handlers, and building comfortable game controls. The main goal is to provide you with some solid knowledge of available input mechanisms and inspire you to create a seamless and natural interface between the player and the game world.

The patterns of input are quite different between mobile devices and desktop browsers. Touchscreens provide a more intuitive way to control the interface, not only in games but also in regular applications. It is more natural to touch a button with your finger, even if the button itself is just a rectangle of glowing pixels on the screen. It is more natural to point to the ...

Get Pro Android Web Game Apps: Using HTML5, CSS3 and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.