28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13 ■ Animating Your Action Figure States: Setting the Image States Based on KeyEvent Processing<br />

Figure 13-21. Testing the InvinciBagel character animation; showing here is the landing animation, using isFlipH<br />

mirror<br />

Now that our arrow keys are invoking the primary run-leap-fly-land game play states, let’s test this new S and W<br />

key logic that we put into place at the end of this chapter, so that we can invoke some of the less-often used (evade<br />

bullet and jump over) sprite cel states, which will add even more diversity to this character animation which we have<br />

put into place during this chapter using only around five dozen lines of code (two dozen in InvinciBagel.java and three<br />

dozen in Bagel.java). As you can see in Figure 13-22 on the left side, when we use the S key the InvinciBagel character<br />

turns sideways so that the bullets fly past (in front of) him, and on the right side of the screen shot, you can see that<br />

when we press the W key, the InvinciBagel character will hurdle over objects!<br />

Figure 13-22. Testing InvinciBagel character animation; shown here is the evade (left) animation, and jumping (right)<br />

You have added quite a significant amount of “wow factor” into this game’s primary InvinciBagel character,<br />

during this chapter covering animation. This will go a long way toward making this a popular game across age groups.<br />

www.it-ebooks.info<br />

297

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!