Game Development Reference
In-Depth Information
As you learned in Chapter 3 , this public abstract method is left empty, or more ac-
curately, unimplemented , in the Actor superclass, but will need to be (that is, will be
required to be) implemented (or alternatively, to again be declared as an abstract meth-
od) in any Actor subclass, including the Hero subclass we are going to be coding later
on.
The method is declared public abstract void , as it does not return any values (it is
simply executed on each JavaFX pulse event) and does not include the {...} curly
braces, as it does not (yet) have any body of code inside of it! The single line of code
that declares the public abstract (empty or unimplemented) method should look like
this:
public abstract void update ();
As you can see in Figure 8-6 , the method is very simple to implement, and once
you add this new method under your Actor() constructor method, your Java 8 code is
again error free, and you will be ready to add more code.
Figure 8-6 . Add an Arrays import statement to support constructor method; add a public abstract .update() method
Next, we will add the rest of the attributes (or variables) for our fixed sprite Actor
superclass, which requires us to think ahead, regarding what we want to be able to ac-
complish with our sprites during the creation of this game.
 
 
Search WWH ::




Custom Search