CHAPTER 17

image

Enhancing Game Play: Creating a Scoring Engine, Adding Treasure and an Enemy Auto-Attack Engine

Now that we’ve implemented collision detection for our game, as well as putting the foundation in place for a scoring engine, let’s finish coding the scoring engine that is called from the .checkCollisions() method, and then add some more game play elements to take advantage of this scoring engine, as well as to make the game play more interesting. To implement our scoring engine display, we will create a gameScore integer variable and scoreText Text object in our InvinciBagel.java class. We will also create a scoreFont Font object, and use ...

Get Beginning Java 8 Games Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.