Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. if(timer){  //Check for Bomb Drop
  2.  
  3.     randAlien = rand() %10; //Pick the starting alien out of 10
  4.  
  5.     int i = 0;
  6.     for(i = 0; i < 10; i++){    //Cycle through all aliens if the first fails
  7.  
  8.         testAlien = randAlien + i % 10; //Ensure cycle loops back after 10
  9.  
  10.         if(alien[testAlien] != dead && alien[testAlien] != lastBomb){   //Check to see if we have the right alien
  11.             int j = 0;
  12.             for(j = 0; j < 4; j++){ //Cycle through all bomb slots
  13.                 if(bomb[j] != visible){ //Check to see if this bomb can be dropped
  14.                     dropBomb(bomb[j]);  //Drop bomb
  15.                     break;  //Stop checking bomb slots once one succeeds
  16.                 }
  17.             }
  18.             break;  //Stop checking aliens once one succeeds
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement