All objects explode.
authorlimb <limb@bc5cbbab-a4ec-0310-bb52-ff3d296db539>
Tue, 10 Jul 2007 17:22:14 +0000 (17:22 +0000)
committerlimb <limb@bc5cbbab-a4ec-0310-bb52-ff3d296db539>
Tue, 10 Jul 2007 17:22:14 +0000 (17:22 +0000)
git-svn-id: svn+ssh://svn/var/repos/curfender@654 bc5cbbab-a4ec-0310-bb52-ff3d296db539

CHANGELOG
main.cpp

index 6546a20..fcf4a9c 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+All objects save bullets explode now, still nonkilling.
 Added death explosions, nonkilling, for player only so far.
 Added saucer boss, level 4.
 Added crawlers, which can shoot and are affected by all weapons.  No pod interaction.
index e66cdad..b563c15 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -1,4 +1,4 @@
-/* 
+/*
    Curfender
    Copyright (C) 2007 Jonathan Ciesla
    This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,7 @@
 #include <time.h>
 #include <cstdio>
 #include <math.h>
+#include <unistd.h>
 
 const int podmax = 8;
 const int bulletmax = 10;
@@ -38,7 +39,7 @@ int level;
 
 int drawlocation = 0;
 int pod_in = 0;
-int pause = 0;
+int pause_game = 0;
 int shieldsleft = 400;
 int tripshot = 0;
 int laser = 0;
@@ -566,6 +567,7 @@ void draw_board(){
 
 void boom_object(game_object boomstuff, game_object object){
   int deathcycle=1;
+  int loop=1;
   boomstuff.active=1;
   while(deathcycle<=7){
     for(int boomx=object.x-10;boomx<=object.x+10;boomx++){
@@ -579,8 +581,9 @@ void boom_object(game_object boomstuff, game_object object){
            } else {
              boomstuff.face = 1;
            };
-           mvprintw(20,20,"Boom");
-           drawlocation = draw_object(boomstuff, drawlocation);
+           for(int iterations=0;iterations<=loop;iterations++){
+             drawlocation = draw_object(boomstuff, drawlocation);
+           };
            refresh();
          };
        };
@@ -588,20 +591,22 @@ void boom_object(game_object boomstuff, game_object object){
     };
     deathcycle++;
   };
-
+  if(object.number!=1){
+    usleep(50000);
+  };
 }
 
 int life_loss(int lives, int score){
   if(lives>=1){
-    pause = 0;
-    while(pause!=' '){
+    pause_game = 0;
+    while(pause_game!=' '){
       cbreak();
       mvprintw(10,20,"Boom.  Press SPACE to continue.\n");
-      pause = getch();
+      pause_game = getch();
     };
     halfdelay(1);
   } else {
-    pause = 0;
+    pause_game = 0;
     
     //record score if high
     
@@ -627,13 +632,13 @@ int life_loss(int lives, int score){
       fclose(writescorefile);
     };
     
-    while(pause!=' '){
+    while(pause_game!=' '){
       cbreak();
       mvprintw(10,20,"GAME OVER. Score:%d  Press SPACE to exit.\n", score);
       if(score>hscore){
        mvprintw(11,20,"High Score: %s", outstring);
       };
-      pause = getch();
+      pause_game = getch();
     };
       endwin();
       exit(0);
@@ -1168,11 +1173,11 @@ int main(){
   mvprintw(23,79,"-");
 
   //hold until SPACE pressed
-  pause = 0;
+  pause_game = 0;
   int counter = 0;
-  while(pause!=' '){
+  while(pause_game!=' '){
     //cbreak();
-    pause = getch();
+    pause_game = getch();
     if(counter>=4){
       //GO!
       mvprintw(18,28,"Press SPACE to start");
@@ -1383,11 +1388,6 @@ int main(){
       drawlocation = draw_object(crawlers[crawlerloop], drawlocation); 
     };
 
-    // Draw player boom
-    //    if(deathcycle>=1){
-
-    //};
-
     drawlocation = draw_object(saucer, drawlocation);
 
     //Radar plot 18x620 represented in 4x62
@@ -1459,13 +1459,13 @@ int main(){
       player = process_direction(player, input);
     };
 
-    //pause
+    //pause_game
     if(input==' '){
-      pause = 0;
-      while(pause!=' '){
+      pause_game = 0;
+      while(pause_game!=' '){
        cbreak();
        mvprintw(10,25,"Paused.  Press SPACE to continue.\n");
-       pause = getch();
+       pause_game = getch();
        halfdelay(1);
       };
     };
@@ -1876,6 +1876,7 @@ int main(){
        if(shieldup==1){
          for(int shieldloop = 0; shieldloop<12; shieldloop++){
            if(check_collision(crazies[crazyloop], shields[shieldloop])==1){
+             boom_object(boomstuff, crazies[crazyloop]);
              crazies[crazyloop] = object_out(crazies[crazyloop]);
              score = score + 20;
            };
@@ -1912,6 +1913,7 @@ int main(){
        if(shieldup==1){
          for(int shieldloop = 0; shieldloop<12; shieldloop++){
            if(check_collision(crawlers[crawlerloop], shields[shieldloop])==1){
+             boom_object(boomstuff, crawlers[crawlerloop]);
              crawlers[crawlerloop] = object_out(crawlers[crawlerloop]);
              score = score + 20;
            };
@@ -2154,11 +2156,11 @@ int main(){
          //Award lives, if any
          if(lives<4){lives++;};
          //Print goodies, getch
-         pause = 0;
-         while(pause!=' '){
+         pause_game = 0;
+         while(pause_game!=' '){
            cbreak();
            mvprintw(10,20,"Level %d Completed.  Press SPACE to continue.\n", level);
-           pause = getch();
+           pause_game = getch();
          };
          halfdelay(1);
          //Advance level