Creating the User Controls
The constructor method of
GameView.java 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 ...