Game Development Reference
In-Depth Information
imageStates(2) is used. If framecounter is less than six, the else part of the statement
increments the framecounter by one with a framecounter+=1; statement. We
wrap framecounter code around both the if(animator) code in both parts of this
structure, as shown in Figure 13-9 :
if(invinciBagel. isRight() ) {
spriteFrame.setScaleX( 1 );
if( !animator ) {
spriteFrame.setImage(imageStates.get( 1 ));
if( framecounter >= runningspeed ) {
animator= true ;
framecounter=0;
} else { framecounter+=1; }
}
else if( animator ) {
spriteFrame.setImage(imageStates.get( 2 ));
if( framecounter >= runningspeed ) {
animator= false ;
framecounter=0;
} else { framecounter+=1; }
}
}
 
 
Search WWH ::




Custom Search