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 17 ■ Enhancing Game Play: Creating a Scoring Engine, Adding Treasure and an Enemy Auto-Attack Engine<br />

Figure 17-60. Adding physics simulation of gravity to the Projectile object's trajectory in the .shootProjectile() method<br />

Summary<br />

In this seventeenth and final chapter, we used all of the foundational elements of our game engine(s) that we have<br />

been building during the course of this book, and created the basic game play for the InvinciBagel game, including a<br />

scoring engine and an auto-attack engine, as well as random attack strategies and basic physics simulation to enhance<br />

realism. We learned how to use the <strong>Java</strong>FX 8.0 Text and Font class to create scoreboard output on the game, and how<br />

to use the <strong>Java</strong> 8 Random class as a random number generator to make our auto-attack engine seem like it had a life of<br />

its own. We also added bounty to the game by coding a Treasure.java class and created a .scoringEngine() method to<br />

track and organize our scoring algorithm. We learned more about optimization, using if-else-if loops with break; and<br />

learned how to use return; to break out of a method prematurely as well, and we used both of these techniques to<br />

great benefit in our game play logic. We added Enemy characters and Projectile objects to the game, and learned how<br />

to implement a background plate behind the game play. I’ve tried to go beyond a basic beginner <strong>Java</strong> 8 book and show<br />

you the work process involved in creating a game engine infrastructure, including the design thought process, how to<br />

leverage key classes in <strong>Java</strong> 8 and <strong>Java</strong>FX 8.0, and how to use new media assets and optimization techniques.<br />

www.it-ebooks.info<br />

453

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

Saved successfully!

Ooh no, something went wrong!