Game Development Reference
In-Depth Information
public Prop(String SVGdata, double xLocation , double
yLocation , Image... spriteCels) {
super (SVGdata, xLocation , yLocation , spriteCels);
spriteFrame.setTranslateX( xLocation );
spriteFrame.setTranslateY( yLocation );
}
@Override
public void update() {
// empty method
}
}
As you can see in Figure 14-8 , this Java code is error-free, and everything that is
needed to define and place a prop in the Scene (on the Stage) is in place, thanks to
good design of the Actor (fixed) sprite class. This includes SVG collision shape data,
the X and Y location (placement in the scene), and one or more Image assets. The reas-
on that we included an .update() method in a fixed sprite class is to allow us to have an-
imated (more than one Image cel) props if we want to get fancy later on in our game
design process, and ratchet up the wow factor of the game's visual design.
Figure 14-8 . Position a fixed sprite on the Stage in the constructor method using a .setTranslateX() and .setTrans-
lateY()
 
 
Search WWH ::




Custom Search