Game Development Reference
In-Depth Information
public Actor(String SVGdata , double xLocation , double
yLocation , Image... spriteCels ) {
spriteBound = new SVGPath();
spriteBound.setContent( SVGdata );
spriteFrame = new ImageView( spriteCels[0] );
imageStates.addAll(Arrays.asList( spriteCels ));
iX = xLocation ;
iY = yLocation ;
}
Notice that the ImageView constructor, invoked using the Java new keyword,
passes the first frame (Image) of the List<Image> ArrayList data you are passing in
using a comma delimited list by using a spriteCels[0] annotation. If you were to create
an overloaded method that allowed you to set up the pivot point data, it might look
like this:
public Actor(String SVG , double xLoc , double yLoc , double
xPivot , double yPivot , Image... Cels ){
spriteBound = new SVGPath();
spriteBound.setContent( SVG );
spriteFrame = new ImageView( Cels[0] );
imageStates.addAll(Arrays.asList( Cels ));
iX = xLoc ;
iY = yLoc ;
pX = xPivot ;
pY = yPivot ;
}
As you can see in Figure 8-5 , you will need to use the Alt-Enter work process, and
have NetBeans code your import statements for the Arrays class for you. Once you do
this, your code will be error free.
 
Search WWH ::




Custom Search