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 10 ■ Directing the Cast of Actors: Creating a Casting Director Engine and Creating the Bagel Actor Class<br />

Figure 10-11. Use Alt-Enter, and have NetBeans write your CastingDirector() constructor method <strong>Java</strong> code for you<br />

We should probably create at least one Actor class (object) for our game’s star character, the InvinciBagel himself,<br />

before we close out this chapter. Let’s use our Hero abstract class to create a Bagel class so that later we can create an<br />

iBagel object. We will use this code in the next chapter, where we will learn how to move this InvinciBagel character<br />

around the Stage, as well as optimizing the structure of our InvinciBagel.java class a bit more as well.<br />

Creating Our Main Actor: The Bagel Hero Subclass<br />

Let’s create a Bagel.java class by right-clicking on the invincibagel package folder in the NetBeans Projects pane<br />

on the left side of the IDE, and select the New ➤ <strong>Java</strong> Class menu sequence to bring up the New <strong>Java</strong> Class dialog,<br />

shown in Figure 10-12. Name the class Bagel and accept the other default Project, Location, Package and Created<br />

File option fields, by clicking on the Finish button, which will create the new Bagel.java class, and open it up in a tab<br />

in NetBeans.<br />

www.it-ebooks.info<br />

223

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

Saved successfully!

Ooh no, something went wrong!