Game Development Reference
In-Depth Information
Figure 10-14
.
Add a public void .update() method to override the public abstract void update method in the Hero
class
Notice at the top of
Figure 10-14
that you will have to add the
import
javafx.scene.image.Image;
code statement in order to be able to use the
Image...
annotation in your
public Bagel()
constructor method parameter list.
Just to be thorough, let's
override
a public Boolean
.collide()
method as well, so
that we have it in the Bagel class. You may be wondering why NetBeans did not give
us an error in
Figure 10-14
when we did not add the .collide() method to the Bagel
class. As you can see in
Figure 10-15
,
which shows the public abstract Hero class, we
didn't make the .collide() method a public abstract method, like we did with the .up-
date() method. This is why NetBeans 8 did not generate any error highlighting, because
we're not required to implement the .collide() method in all Hero subclasses.