Pro Java 9 Games Development Leveraging the JavaFX APIs

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

At this point, you’ll have to finish the next four Q2S2 through Q2S5 game board square
setupQSgameplay() methods, and the corresponding createQAprocessing() scoring engine logic, to be
halfway done with your content for half of your board game. This is shown in Figure 23-8 on the right side;
to save space I did not show all of the game board spin screen captures involved for all of this work (and its
testing work process). There is a lot of work involved in coding the 600 lines of code needed to finish this
gameplay content (about 480 for createQAprocessing() and about 100 for 20 of the setupQSgameplay()
methods), so this took me around a day to code and test. I took some screenshots along the way, which I will
show later in this section of the chapter.
As you add game board square content and scoring logic to your game, be sure to use your Run ➤
Project work process often to test new Java code that adds Answer Button objects, as well as the code that
wires these to the createQAprocessing() scoring engine method, to see whether it gives you the desired
gameplay result. As you can see in Figure 23-8, the second quadrant answers and scoring are working
correctly, and I can move on to do quadrant 3.
As you can also see in Figure 23-9, the third quadrant answers and scoring are now working correctly,
and I can move on to add the answers and scoring code for quadrant 4. At this point, your board game
should be working fairly well, and we can now start to add code that prevents the game player from clicking
UI elements more than once.


As you can see in Figure 23-10, the gameplay content is now in place, and we can proceed with player
proofing.


Figure 23-9. Use a Run ➤ Project work process to test the Q3S1 through Q3S5 answers and scoring logic
before moving on


Figure 23-10. Use the Run ➤ Project work process to test the Q4S1 through Q4S5 answers and scoring logic to
finish 20 squares

Free download pdf