From: limb Date: Tue, 10 Jul 2007 15:48:55 +0000 (+0000) Subject: Added death explosions, non killing for player only so far. X-Git-Tag: 1.01~66 X-Git-Url: http://git.pulsar-zone.net/?a=commitdiff_plain;h=873f2d5fa0ba3b94424875a26ea9af552abd85ec;p=curblaster.git Added death explosions, non killing for player only so far. git-svn-id: svn+ssh://svn/var/repos/curfender@652 bc5cbbab-a4ec-0310-bb52-ff3d296db539 --- diff --git a/CHANGELOG b/CHANGELOG index 6774949..6546a20 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +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. Added static markers on ground for frame of reference. diff --git a/main.cpp b/main.cpp index e9d3cc8..a7e2e59 100644 --- a/main.cpp +++ b/main.cpp @@ -23,6 +23,7 @@ #include #include #include +#include const int podmax = 8; const int bulletmax = 10; @@ -41,7 +42,6 @@ int pause = 0; int shieldsleft = 400; int tripshot = 0; int laser = 0; - struct game_object { int number; //object number int active; //object active, 1 or 0 @@ -564,6 +564,32 @@ void draw_board(){ mvprintw(22,9,"S:%3d", shieldsleft); } +void boom_object(game_object boomstuff, game_object object){ + int deathcycle=1; + boomstuff.active=1; + while(deathcycle<=7){ + for(int boomx=object.x-10;boomx<=object.x+10;boomx++){ + for(int boomy=object.y-10;boomy<=object.y+10;boomy++){ + if(sqrt((abs(object.y-boomy)*abs(object.y-boomy))+(abs(object.x-boomx)*abs(object.x-boomx)))<=deathcycle){ + if(rand()%1000>900){ + boomstuff.x = boomx; + boomstuff.y = boomy; + if(rand()%1000>500){ + boomstuff.face = 0; + } else { + boomstuff.face = 1; + }; + drawlocation = draw_object(boomstuff, drawlocation); + refresh(); + }; + }; + }; + }; + deathcycle++; + }; + +} + int life_loss(int lives, int score){ if(lives>=1){ pause = 0; @@ -1028,6 +1054,21 @@ int main(){ strcpy (saucer.line1, "/==O==\\"); strcpy (saucer.radar, "O"); + //boomstuff + game_object boomstuff; + boomstuff.number = 400; + boomstuff.active = 0; + boomstuff.x = 0; + boomstuff.y = 0; + boomstuff.direction = 5; + boomstuff.face = 1; + boomstuff.speed = 0; + boomstuff.vspeed = 0; + boomstuff.vtime = 0; + boomstuff.phase = 0; + strcpy (boomstuff.line0, "\\"); + strcpy (boomstuff.line1, "/"); + initscr(); //Check screen size 80x24 and exit if not big enough @@ -1341,6 +1382,11 @@ 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 @@ -1761,6 +1807,7 @@ int main(){ lives--; //add to score score = score + 20; + boom_object(boomstuff, player); life_loss(lives, score); player = player_init(player); drawlocation = player.y-20; @@ -1796,6 +1843,7 @@ int main(){ lives--; //add to score score = score + 20; + boom_object(boomstuff, player); life_loss(lives, score); player = player_init(player); drawlocation = player.y-20; @@ -1831,6 +1879,7 @@ int main(){ lives--; //add to score score = score + 20; + boom_object(boomstuff, player); life_loss(lives, score); player = player_init(player); drawlocation = player.y-20; @@ -1863,6 +1912,7 @@ int main(){ if(check_collision(player, saucer)==1){ //kill player only lives--; + boom_object(boomstuff, player); life_loss(lives, score); player = player_init(player); drawlocation = player.y-20; @@ -2018,7 +2068,8 @@ int main(){ //kill landershot and player lives--; landershot[landershotloop].vtime = 100; - landershot[landershotloop] = age_bullet(landershot[landershotloop]); + landershot[landershotloop] = age_bullet(landershot[landershotloop]); + boom_object(boomstuff, player); life_loss(lives, score); player = player_init(player); drawlocation = player.y-20;