Game Development Reference
In-Depth Information
Figure 14-6 . Add a public Prop() constructor, and mouse-over the error highlight, and select Add import for Image
class
If you still see that wavy red error highlight, once you have imported the Image
class reference, it is because you need to pass the parameter list in your Prop() con-
structor method definition “up to” the Actor class. This is done using the Java super
keyword, sometimes called a super() constructor (method), using the following Java
statement:
super (SVGdata, xLocation, yLocation, spriteCels);
Since this Prop class uses a default, or unflipped (unmirrored) imageStates(0) im-
age for the class, this is the first thing that we need to do to make a usable Prop class
that is in conformance with the abstract Actor class. Also, remember that the Actor
class initializes all of the flag properties for us, thanks to a detailed design process. The
Java code for the class, which now includes the basic super constructor, and is now
error-free, can be seen in Figure 14-7 :
 
 
Search WWH ::




Custom Search