-/*
+/*
Curfender
Copyright (C) 2007 Jonathan Ciesla
This program is free software; you can redistribute it and/or modify
#include <time.h>
#include <cstdio>
#include <math.h>
+#include <unistd.h>
const int podmax = 8;
const int bulletmax = 10;
int drawlocation = 0;
int pod_in = 0;
-int pause = 0;
+int pause_game = 0;
int shieldsleft = 400;
int tripshot = 0;
int laser = 0;
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++){
} 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();
};
};
};
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
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);
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");
drawlocation = draw_object(crawlers[crawlerloop], drawlocation);
};
- // Draw player boom
- // if(deathcycle>=1){
-
- //};
-
drawlocation = draw_object(saucer, drawlocation);
//Radar plot 18x620 represented in 4x62
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);
};
};
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;
};
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;
};
//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