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.

■ Contents<br />

Optimizing the Scene Graph: Using the Group Class386<br />

Creating a Scoring Engine Method: .scoringEngine( )389<br />

Summary390<br />

■■Chapter 17: Enhancing Game Play: Creating a Scoring Engine,<br />

Adding Treasure and an Enemy Auto-Attack Engine393<br />

Creating the Score UI Design: Text and Font Objects394<br />

Creating a SCORE Label: Adding the Second Text Object 397<br />

Creating the Scoring Engine Logic: .scoringEngine( )399<br />

Optimizing the scoringEngine( ) Method: Using Logical If Else If 402<br />

Adding Bounty to the Game: The Treasure.java Class403<br />

Using the Treasure Class: Create Treasure Objects in the Game 404<br />

Adding Treasure Collision Detection: Updating .scoringEngine( ) 406<br />

Adding Enemies: The Enemy and Projectile Classes407<br />

Creating Cream Cheese Bullets: Coding a Projectile.java Class 409<br />

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

Adding a Background Image: Using .toBack( ) Method413<br />

Using Random Number Generators: java.util.Random416<br />

Mounting the Attack: Coding the Enemy Onslaught417<br />

The Foundation of an Enemy Class Attack: The .update( ) Method 418<br />

Attacking on Both Sides of the Screen: .initiateAttack( ) Method 419<br />

Adding the Element of Surprise: Animating Your Enemy Attack 424<br />

Weaponizing the Enemy: Shooting Projectile Objects429<br />

Creating a Projectile Infrastructure: Adding Projectile Variables 431<br />

Invoking a .shootProjectile( ) Method: Setting shootBullet to True 433<br />

Shooting Projectiles: Coding the .shootProjectile( ) Method 434<br />

Making the Enemy Pause Before Firing: pauseCounter Variable 435<br />

Shoot the Bullet: Pulling the Trigger Using the launchIt Variable 436<br />

xvi<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!