Creating the User Controls

The constructor method of has several newcomers. This section dissects the new sprites that are used primarily for user interaction and also shows you a new concept. Rather than create four different cannon icons that point in all of the cardinal directions, you rotate one image for the four different sprites. This saves space on your machine, but it also causes some extra processor work at startup.

To demonstrate the alternative, the main cannons are all individual sprites that don’t need to be rotated. The method you use on such occasions depends on your resources and how much space you have on disk.

Follow these steps:

1. Before you can start working with the new sprites, you must first declare the ...

Get Beginning Android Tablet Games Programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.