HTML and CSS Reference
In-Depth Information
Listing I.20. Move Wilson toward the target position
The code in the previous listing is a bit rough and ready, but it will produce a fairly natural-
looking deceleration toward the target point everywhere but at the edges without your hav-
ing to worry about mapping floating point numbers into an integer coordinate space. When
you write your killer gaming app based on this sample, you should definitely spend a little
more time on it!
Now you're ready to hook the various components together in the go() function. Replace
your go() function from listing I.17 with the version in the following listing.
Search WWH ::

Custom Search