Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 19 ■ Game Content enGine: ai LoGiC with random Content SeLeCtion methodS

Now let’s use a Run ➤ Project work process and see whether the quadrants populate with the correct
content now that we have put “dummy” (quadrant 1) content into the populateQuadrantTwo() method
body. When we click the spinner, the code should now select a random quadrant and then populate that
quadrant with content. Any visual result other than the front quadrant at the front of the game board filled
with random images would mean that there is something still amiss in the code and we’d still need to
continue our game development debugging process!
As you can see in Figure 19-12, the first spin of an angle offset of 45 degrees, which we know is quadrant
3 (pink or other content), is selecting the correct content, but the onFinished event handling construct is
populating quadrant 2 (225 degrees angle offset) instead of the correct quadrant 3! We have some more
debugging to do!


Figure 19-11. Duplicate populateQuadrantOne code in populateQuadrantTwo and configure the squares 6
through 10

Free download pdf