Game Development Reference
In-Depth Information
public boolean hasValu() {
return hasValu;
}
public void setHasValu(boolean hasValu) {
this.hasValu = hasValu;
}
public boolean isFlipV() {
return isFlipV;
}
public void setIsFlipV(boolean isFlipV) {
this.isFlipV = isFlipV;
}
public boolean isFlipH() {
return isFlipH;
}
public void setIsFlipH(boo lean isFlipH) {
this.isFlipH = isFlipH;
}
Notice that in addition to the .get() and .set() methods generated, for the boolean
variables there is also an additional .is() method that is generated instead of the .get()
method. Since I already named the boolean flags using the “is” preface, I am going to
remove the second “Is” so that these “double is” methods are more readable. I am also
going to do this to the hasValu method, so that inquiring as to the boolean setting in the
method call is more natural, for instance, .hasValu(), isFlipV(), isBonus(), isFixed() or
.isFlipH() for instance. I suggest that you perform the same edits with your code, for
readability purposes.
Now we are ready to create our Hero subclass , which will add another eleven at-
tributes to the thirteen we have created in the Actor class, bringing the total to an even
two dozen. These additional eleven attributes held in the Hero class will be used with
movable sprites that can move around the screen (I like to call these motion sprites).
Our InvinciBagel character will be the primary Hero Actor object in the single-player
Search WWH ::




Custom Search