}
+game_object pod_init(game_object pod){
+ pod.active=1;
+ pod.x = 18; //always start on ground
+ pod.y = rand()%620; //anywhere along the surface
+ pod.direction = rand()%1000;
+ if(pod.direction<500){
+ pod.direction = 4;
+ } else {
+ pod.direction = 6;
+ };
+ pod.speed = 1;
+
+ return pod;
+}
+
game_object pod_out(game_object pod){
pod.active=0;
pod.x = 0;
int pod_check(game_object pod, game_object player){
int pod_in = 0;
- if((pod.x==player.x)&&(abs(player.y-pod.y)<player.speed)){
+
+ if( (pod.x==player.x)&&((abs(player.y-pod.y)<player.speed&&player.speed>0)||(player.y==pod.y))){
pod_in = pod.number;
};
-
+
return pod_in;
}
srand(time(NULL));
+ level = 1;
score = 0;
lives = 4;
//process object motion
player = process_motion(player, player);
+ //for(int podloop = 0; podloop>7; podloop++){ pods[podloop] = process_motion(pods[podloop], player); };
+
pod2 = process_motion(pod2, player);
pod3 = process_motion(pod3, player);
pod4 = process_motion(pod4, player);
pod7 = process_motion(pod7, player);
pod8 = process_motion(pod8, player);
pod9 = process_motion(pod9, player);
+
// Draw player object 1
drawlocation = draw_object(player, drawlocation);
//check for 0 active pods, saved pods, level victory
podcount = pod2.active+pod3.active+pod4.active+pod5.active+pod6.active+pod7.active+pod8.active+pod9.active;
if(podcount<=0){
- //Advance level
//Tally bonuses
//Award lives, if any
+ if(lives<4){lives++;};
//Print goodies, getch
+ cbreak();
+ mvprintw(10,20,"Level %d Completed. Press any key to continue.\n", level);
+ getch();
+ halfdelay(1);
+ //Advance level
+ level++;
//Reactivate pods if not zombied, regen enemies
+ pod2 = pod_init(pod2);
+ pod3 = pod_init(pod3);
+ pod4 = pod_init(pod4);
+ pod5 = pod_init(pod5);
+ pod6 = pod_init(pod6);
+ pod7 = pod_init(pod7);
+ pod8 = pod_init(pod8);
+ pod9 = pod_init(pod9);
};
}; //end main loop