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 />

This return; statement is a central component to making this method work, because if any Actor object of that<br />

type exists, a duplicate one will not be added to the List Array, which would cause an error to occur. This is<br />

a great way to make sure that we only use one Node for each type of Projectile and Enemy object, which allows us to<br />

optimize both memory and processor overhead. The <strong>Java</strong> 8 programming structures for all three of these methods is<br />

quite similar, and can be seen in Figure 17-48. The three private void method bodies should look like the following:<br />

private void loadBullet() {<br />

for (int i=0; i

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

Saved successfully!

Ooh no, something went wrong!