|
@@ -19,8 +19,6 @@ using std::cout;
|
|
|
using std::endl;
|
|
|
using std::min;
|
|
|
|
|
|
-int ENEMY_NUM=1;
|
|
|
-
|
|
|
int main(int argc,char** argv)
|
|
|
{
|
|
|
if(argc>1){
|
|
@@ -61,6 +59,7 @@ int main(int argc,char** argv)
|
|
|
//PARAMETERS/UTILITIES
|
|
|
double shootrate; //probability of an enemy shooting a bomb
|
|
|
double poweruprate; //probability of a powerup being dropped
|
|
|
+ int enemy_num; //number of enemies in the current match
|
|
|
int command; //keyboard input
|
|
|
int score=0; //score: gain +100 when an enemy is destroyed and +50 when a bomb is destroyed
|
|
|
int level=1; //difficulty level
|
|
@@ -107,8 +106,8 @@ int main(int argc,char** argv)
|
|
|
WALLS_NUM=2;
|
|
|
|
|
|
level = choose_level(commands); // get desired level
|
|
|
- setup_level(level, shootrate, poweruprate, refresh_time, boss1, ENEMY_NUM, commands); // set game parameters and boss
|
|
|
- load_enemies(enemies,ENEMY_NUM);
|
|
|
+ setup_level(level, shootrate, poweruprate, refresh_time, boss1, enemy_num, commands); // set game parameters and boss
|
|
|
+ load_enemies(enemies,enemy_num);
|
|
|
player1.set_commands(commands);
|
|
|
erase();
|
|
|
|
|
@@ -192,7 +191,7 @@ int main(int argc,char** argv)
|
|
|
{
|
|
|
//mvaddch(it->y,it->x,' ');
|
|
|
it->next_pos(); //evaluate new positions
|
|
|
- if(it->alive && (double)rand()/RAND_MAX<(shootrate*ENEMY_NUM/n_enemies)){ //try a bomb-dropping
|
|
|
+ if(it->alive && (double)rand()/RAND_MAX<(shootrate*enemy_num/n_enemies)){ //try a bomb-dropping
|
|
|
//if(sound) shoot_sound = pthread_create(&thread[1],NULL,penshoot_sound,NULL);
|
|
|
it->shoot(bombs);
|
|
|
}
|
|
@@ -280,8 +279,8 @@ int main(int argc,char** argv)
|
|
|
refresh();
|
|
|
if(choice=='n')
|
|
|
level = choose_level(commands); // get desired level
|
|
|
- setup_level(level, shootrate, poweruprate, refresh_time, boss1, ENEMY_NUM, commands); // set game parameters and boss
|
|
|
- load_enemies(enemies,ENEMY_NUM);
|
|
|
+ setup_level(level, shootrate, poweruprate, refresh_time, boss1, enemy_num, commands); // set game parameters and boss
|
|
|
+ load_enemies(enemies,enemy_num);
|
|
|
reset(player1, enemies, boss1, bullets, bombs, walls, powerups,rockets, level,chflag); // reset box, player, enemy and deletes all bullets and bombs
|
|
|
erase();
|
|
|
refresh();
|