Until now, what we were doing was using a single file for the player, enemy, rocket, and bullet. Every time we create a new rocket, the game goes and gets the memory, and finds and retrieves the image. The process is repeated every time a bullet is created. This is okay for a simple game such as ours, but later, when we start creating more complex games with a lot more enemies and bullet types, the process will become very taxing on the device, and the performance of the game will be affected.
To solve this problem, sprite sheets are used. A sprite sheet contains all the images that we will use in the game in a single file, instead of 10 images sitting at 10 different memory locations. The sprite sheet image file will also be accompanied by a data file, which will contain the location and size of each of the images located in the sprite sheet. At the start of the game, the sprite sheet image and data file are loaded into the cache once. Then, every time the rocket or...