HTML and CSS Reference
In-Depth Information
Listing I.17. Example app page framework
Step 2: Create a function to draw an image at a particular position
Our image will be the Wilson character from chapter7 , this time in canvas form. Because
you'll need to maintain state information about where Wilson is, what he's aiming for, and
how quickly he's moving toward it, the function to draw Wilson will be part of an object.
Listing I.18 shows the initial version of this. It's a long and mostly irrelevant listing as far
as the new features are concerned, but the rest of the examples won't work without this bit
of code, so you need it. There's no need to understand it thoroughly. This code should go
between the go() function and the draw_welcome() function in listing I.17 .
Search WWH ::

Custom Search