Game Development Reference
In-Depth Information
Figure 17-44 . Add a pauseCounter variable to create a timer, creating a one-second delay, so Enemy doesn't bounce
ShoottheBullet:PullingtheTriggerUsingthelaunchIt
Variable
Inside of each of your if(takeSides) and if(!takeSides) conditional if structures, modi-
fy the if(onScreen) structure to be an if(onScreen && launchIt) structure instead, and
then add a launchit = false; statement into the else portion of this modified structure.
The Java code for the new if() structure is shown in Figure 17-45 , and looks like the
following:
if( onScreen && launchIt ) {
destination = 700;
if(spriteMoveR <= destination) {
spriteMoveR+=1;
spriteFrame.setTranslateX(spriteMoveR);
} else {
onScreen = false;
takeSides = true; // This will be false if
inside of the if(takeSides) structure
callAttack = false;
 
 
Search WWH ::




Custom Search