Game Development Reference
In-Depth Information
skyCloud Image object declaration to the end of the private Image object declarations
for the splashscreen related image assets, as seen at the top of
Figure 17-24
. As you can
see, there will be a warning highlight under this object until you implement (use) it in
your Java code. Next, instantiate a skyCloud object in .loadImageAssets(), as seen at
the bottom of
Figure 17-24
, using the following code:
private Image splashScreen, instructionLayer, legalLayer,
scoresLayer,
skyCloud
;
skyCloud
=
new
Image("
/skycloud.png
", 640, 400, true,
false, true);
Figure 17-24
.
Declare and instantiate a skyCloud Image object that references a skycloud.png background image
asset
Now you have a skyCloud object, so use a
.setImage()
method to set a
SplashScreenBackground ImageView Node, to use this image asset inside the
gameButton.setOnAction(ActionEvent) code block, so that when you click the PLAY
GAME Button, this image is set as the backplate image. Also, make sure to use the
.setVisible()
method call with a value of
true
, so that the ImageView Node will be vis-
ible. The Java code, shown in
Figure 17-25
, should look like this:
splashScreenBackground.setImage(
skyCloud
);
splashScreenBackground.setVisible(
true
);