char radar[1]; //radar symbol
};
+int check_collision(game_object object1, game_object object2){
+ int collided = 0;
+
+ if(object1.x==object2.x){
+ if(abs(object1.y-object2.y)<=2){
+ collided=1;
+ };
+ };
+
+ return collided;
+};
+
game_object age_bullet(game_object object){
if(object.vtime>=80){
object.active = 0;
int input = 0;
int lastkey = 0; //debug
int podcount = 0;
+ int podsin = 0;
cbreak();
halfdelay(1);
for(int podloop = 0; podloop<8; podloop++){ radar_plot(pods[podloop], drawlocation); };
//debug
- mvprintw(21,1,"Lastkey:%d", lastkey);
+ //mvprintw(21,1,"Lastkey:%d", lastkey);
+
+ //pod state
+ mvprintw(21,1,"Out: %d In: %d", podcount, podsin);
//get the cursor out of the way
mvprintw(23,79,"|");
//increment score
score = score + 10;
+ podsin++;
pod_in = 0;
strcpy (player.line0, "<==_>");
strcpy (player.line1, "<_==>");
bullets[bulletloop].active=1;
if(player.face==0){ bullets[bulletloop].direction = 4; };
if(player.face==1){ bullets[bulletloop].direction = 6; };
- bullets[bulletloop].speed = player.speed + 1;
+ bullets[bulletloop].speed = player.speed + 2;
bullets[bulletloop].x = player.x;
int multiplier = 1;
if(player.direction == 4){multiplier = -1; };
};
};
- lastkey = input;
+ //lastkey = input; debug
//check bullets
//for each active bullet
- //check each active pod
+ for(int bulletloop = 0; bulletloop<4; bulletloop++){
+ if(bullets[bulletloop].active==1){
+ //check each active pod
+ for(int podloop = 0; podloop<8; podloop++){
+ if(pods[podloop].active==1){
+ if(check_collision(bullets[bulletloop], pods[podloop])==1){
+ //kill pod and bullet
+ pods[podloop] = pod_out(pods[podloop]);
+ bullets[bulletloop].vtime = 100;
+ bullets[bulletloop] = age_bullet(bullets[bulletloop]);
+ };
+ };
+ };
+ //check each active enemy
+ };
+ };
- //check each active enemy
-
//check for 0 active pods, saved pods, level victory
podcount = 0;
for(int podloop = 0; podloop<8; podloop++){ podcount = podcount + pods[podloop].active; };
level++;
//Reactivate pods if not zombied, regen enemies
for(int podloop = 0; podloop<8; podloop++){ pods[podloop] = pod_init(pods[podloop]); };
+ podsin = 0;
};
}; //end main loop