Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 19 ■ Game Content enGine: ai LoGiC with random Content SeLeCtion methodS


However, the selected quadrant on the screen is quadrant 4, which means I have to shift the angle
offset numbers in my onFinished() event-handling conditional if() code around by one so that 315 will move
to the top of the evaluation statements, pushing the other three angle offset evaluations down by one angle
evaluation each.
The new Java code, which we will test next and is shown in Figure 19-9, rotates everything around by
one and now looks like the following conditional if() evaluation block of statements:


rotGameBoard.setOnFinished(event->{
if (quadrantLanding == 315 ) { populateQuadrantOne(); }
if (quadrantLanding == 45 ) { populateQuadrantTwo(); }
if (quadrantLanding == 135 ) { populateQuadrantThree(); }
if (quadrantLanding == 225 ) { populateQuadrantFour(); }
});


Figure 19-8. Test the OnFinished code with the quadrant content code, and notice that the angle offsets are off
by one

Free download pdf