28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 17 ■ Enhancing Game Play: Creating a Scoring Engine, Adding Treasure and an Enemy Auto-Attack Engine<br />

Figure 17-2. Instantiate a scoreText object using a <strong>Java</strong> new keyword and call the .setText() and .setLayout() methods<br />

For now, we are going to use the X,Y position value of 365,565, as you can see in Figure 17-2. To be able to style<br />

this Text object, we will need to declare a private Font object, named scoreFont, as seen in Figure 17-3. Use the<br />

Alt-Enter work process again on the red error highlight, and select the “Add import for javafx.scene.text.Font” option.<br />

Figure 17-3. Add a private Font scoreFont declaration and use Alt-Enter and select “Add import javafx.scene.text.Font”<br />

www.it-ebooks.info<br />

395

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!