#include <cstdlib>
#include <time.h>
#include <cstdio>
+#include <math.h>
const int podmax = 8;
const int bulletmax = 10;
int shieldsleft = 400;
int tripshot = 0;
int laser = 0;
-
struct game_object {
int number; //object number
int active; //object active, 1 or 0
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;
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
drawlocation = draw_object(crawlers[crawlerloop], drawlocation);
};
+ // Draw player boom
+ // if(deathcycle>=1){
+
+ //};
+
drawlocation = draw_object(saucer, drawlocation);
//Radar plot 18x620 represented in 4x62
lives--;
//add to score
score = score + 20;
+ boom_object(boomstuff, player);
life_loss(lives, score);
player = player_init(player);
drawlocation = player.y-20;
lives--;
//add to score
score = score + 20;
+ boom_object(boomstuff, player);
life_loss(lives, score);
player = player_init(player);
drawlocation = player.y-20;
lives--;
//add to score
score = score + 20;
+ boom_object(boomstuff, player);
life_loss(lives, score);
player = player_init(player);
drawlocation = player.y-20;
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;
//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;