Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 23 ■ Completing the gameplay Code and player proofing your event handling


Use the Run ➤ Project work process shown in Figure 23-6 and test the Q1S2 game board square logic to
see whether it scores the correct answer (Duckling) by incrementing the “Right:” score UI panel integer Text
object by one.


Next, I finished up the third through fifth game board square gameplay setup methods and tested their
code to make sure I connected the correct answer Button scoring logic in my createQAprocessing() method
body. The code in this method body will reach around 500 lines of code once we are finished adding scoring
logic and, later, a variable that will lock the Button click event handling once an answer has been selected.
There is some very cool coding to come, which I cover a bit later in this chapter, when we write code to
“player proof ” the game against multiple mouse clicks on the UI.
As you will see in Figure 23-7, the answer scoring logic for the first six game board squares (30 percent
done already) is filling the IDE screen for Button 1 with three dozen lines of code, which means that we have
a dozen lines of code (144 lines) done for all four buttons.


Figure 23-6. Use a Run ➤ Project work process and test your Q1S2 answers and scoring logic before moving
on to Q1S3

Free download pdf