Game Development Reference
In-Depth Information
tion sprites do. As you may have guessed, List<Image> is a Java List object filled with
JavaFX Image objects. The iX and iY variables in the Actor class are image (or initial)
placement X and Y locations, which place a fixed sprite on your game level layout, but
will also hold current sprite position for motion sprites, when assumed by the Hero
subclass. Other variables hold Boolean states (alive/dead, etc.) and lifespan, damage,
offset, collision, or physics data we'll need later.
The InvinciBagel Sprite Images: Visual
Action States
Besides designing the optimal Actor Engine classes to use to implement characters,
treasure, and obstacles in a game, the other important thing to optimize is the main
character for the game, and the different states of animation that a character will move
between, based on the movement of the character by the player. From a memory optim-
ization standpoint, the fewer image frames that we can accomplish all of this in, the
better. As you can see in Figure 8-2 , I will provide all of the InvinciBagel character
motion states using only nine different sprite image assets; some of these can be used
in more than one way: for instance, by using the pX and pY variables, which will al-
low us to rotate these sprite frames around any pivot point that we choose. An example
of this is center pivot point placement for the FLY state, seen in the middle of Figure
8-2 , which gives us a take-off (fly up), flying, and landing (fly down) simply by rotat-
ing this image 50 degrees clockwise (to a horizontal orientation) to 100 degrees clock-
wise (tilting to fly down, instead of up).
Figure 8-2 . The nine primary character motion sprites for the InvinciBagel character that will be used during the
game
Even though we are providing offset and pivot point capabilities in our sprite Act-
or Engine abstract classes, that doesn't mean that we should not make sure that our mo-
tion sprite image states are well synchronized with each other. This is so that we do
not routinely have to use these pivot or offset capabilities to get good visual results.
 
 
Search WWH ::




Custom Search