9.4. Practical techniques for moving objects

9.4.1. Moving the Pacman

The ability to control the movement of an object is vital for many entertainment industries on the Web. The techniques can be quite complicated. In order to focus on a basic level, only left, right, up, and down straight movements are considered. In terms of the keyboard, the following keys are used to trigger the actions:

“a” key – Move left“w” key – Move up
“d” key – Move right“s” key – Move down

These keys are located on the left hand side of your keyboard and can be easily controlled by your left hand. Also, these keys exist on all kinds of keyboards including those on laptop computers. The object you are going to create is simple – the “Pacman.” This object has four different ...

Get Practical Web Technologies 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.