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

}<br />

isFixed = false;<br />

isBonus = true;<br />

hasValu = true;<br />

}<br />

@Override<br />

public void update() { // Empty Method }<br />

Figure 17-20. Create a Projectile.java class, override the .update() method, and code a Projectile() constructor method<br />

Adding an Enemy and Projectiles to the Game: InvinciBagel.java<br />

Open the InvinciBagel.java tab in NetBeans and declare an Enemy object, named iBeagle, and two Projectile objects,<br />

named iBullet and iCheese, underneath the iBagel Bagel object, as shown highlighted in Figure 17-21. Next, declare<br />

three Image objects, iE0, iC0, and iC1, by adding the object names at the end of the second private Image declaration.<br />

410<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!