Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 22 ■ SCoring engine: Creating the SCore Ui LayoUt and SCoring the Content


Again, use your Run (^) ➤ Project work process shown in Figure 22-35 to render the game and navigate to
the Score UI panel to check to see whether this spaces the number display so that 10 to 99 scores look great
when displayed in the Score UI panel.
Most players will not play (spin) the game board hundreds of times in one play session, so this should
work well for this game. However, notice that three digits (100 to 999) should also fit.
However, if you are expecting this much gameplay, you may want to space the labels (headings) four to
eight units further to the left side of the Score UI design, which would then accommodate your triple-digit
gameplay scores comfortably.
Now you are ready to “proliferate” the code that we wrote in this chapter on scoring and in Chapter 21 to
create the entire gameplay infrastructure. This is going to add another 1,000 lines of code to the 1,000 (or more)
lines of Java code that we have already created over 22 chapters to put the entire i3D board game infrastructure
in place. Let’s talk about how to do this next. This is a lot of work regarding 2D content (images, answer options,
and scoring), but it is going to integrate seamlessly with the i3D board game that we have created so far using
the JavaFX 9 APIs.
Completing the Gameplay: Add Answers and Score
Adding 4 answers for 60 different game board square options involves 240 different content options (and lines
of code), and adding scoring for those 60 different game board square options involves another 480 lines of
code and possibly a little more with the lambda expression containers included. The reason that this is a lot of
work that should be fairly easy to perform error-free is that we have created a code design that can be copied
and pasted into place and that Text values can be created, inserted, and tracked so that the game content
will work correctly when played. That said, don’t expect that creating the content for your professional Java
9 game development pipeline to be any easier than creating the Java 9 code is (was), as game design and
game development involves a plethora of new media, content, strategy, and coding work to end up with a
professional result.
Figure 22-35. Use the Run ➤ Project work process and click the Button elements to increment (test)
double-digit scores

Free download pdf