Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 23 ■ Completing the gameplay Code and player proofing your event handling

It is important that you do this work process very carefully so that your answers, correct and incorrect,
for each of your 20 setupQSgameplay() methods match up perfectly with your createQAprocessing()
scoring algorithm’s method body. These have to match up perfectly in order for your scoring engine to score
the gameplay accurately, as you can see by comparing Figures 23-1 and 23-2 on a question-by-question and
answer-by-answer basis.
You can either do the testing as you go along, game board square by game board square, or all at one
time when you have finished. Or you can do it both ways, which is what I did, to try to generate code that was
free from errors at both compile time and runtime. With thousands of lines of code and a Java 9 (and JavaFX
9) API that was in beta while I was writing this book, this is clearly no easy task, especially when I had to turn
in one completed chapter every week.
Use the Run ➤ Project work process to render the code and 3D and test game board square 1 in your
first quadrant, as shown in Figure 23-3. I recommend doing this one square (and one quadrant) at a time so
that you can take advantage of code “patterns,” which can be seen by comparing Figures 23-1 and 23-2. You
can visually tell which game board square, game board quadrant, Button number, and random question
selection you are working with based on the Java code object names and variable names that I have utilized
specifically for this purpose.


Figure 23-2. Add matching correct or incorrect answer score processing to the createQAprocessing() method
for Q1S1

Free download pdf