HTML and CSS Reference
In-Depth Information
Listing 6.14. game.js—Touch controls
If a device doesn't support the touch events you created, don't worry; unsupported events
will be ignored and the game will run normally. You can try any mobile device, but we
can't guarantee it will work.
6.3.4. Control input considerations
In the past couple of years JavaScript keyboard support for applications and websites has
grown by leaps and bounds. YouTube, Gmail, and other popular applications use keyboard
shortcuts to increase user productivity. Although allowing users to speed up interaction is
great, it can quickly unravel into a usability nightmare.
You need to be careful when declaring keyboard keys in JavaScript. You could override
default browser shortcuts, remove OS functionality (copy, paste, and so on), and even acci-
dentally close the browser. The best way to avoid angering players is to stick to arrow and
letter keys. Specialty keys such as the spacebar can be used, but overriding Shift, the Mac/
Windows key, and/or Caps Lock could have unforeseen repercussions. If you must use a
keyboard combination or specialty key, ask yourself, “Will these controls be problematic
for my users?”
Search WWH ::

Custom Search