Game Development Reference
In-Depth Information
As you can see in Figure 11-5 , your code is error-free, which means that you have
copied your sprite assets into the proper /src folder, and you now have more than a
dozen digital image assets installed for use in your game.
Figure 11-5 . Create a private void loadImageAssets() method, add the iB0 through iB8 and splashScreen Image ob-
jects
Now that the assets you need to call your Bagel() constructor method that you cre-
ated in Chapter 10 are in place, we can move on to creating a method that holds our
game asset creation Java code. This amounts to calling the constructor methods for
each of the Actor subclasses we eventually create, the first of which was the Bagel
class, which we created first so that we can start to work on getting our primary charac-
ter moving around the screen.
Creating Your InvinciBagel Bagel Object: .cre-
ateGameActors()
The next step in the game actor creation process after loading your image assets is to
call the constructor method for the game actor. To be able to do this, you must first sub-
class either the Actor superclass (for fixed game actors, which could be called “props”)
or the Hero superclass (for motion game actors, such as the Hero, his enemies, and the
like). I am going to create a .createGameActors() method to hold these instantiations,
because even though initially there is only going to be one line of code inside of the
 
 
Search WWH ::




Custom Search