O'Reilly logo

Practical Web Technologies by V. Lau, P. K. Yuen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required