diff --git a/code/display.c b/code/display.c index 457067fe09a850b181821ceaca37c5861595793e..0f4b22b83e349a985253c8aa07fba33ff4308fb9 100644 --- a/code/display.c +++ b/code/display.c @@ -86,6 +86,13 @@ void refresh_graphics(SDL_Renderer *renderer, world_t *world,resources_t *resour SDL_RenderCopy(renderer, resources->bullet, NULL, &world->soldier.DestBullet[i]); } + if(world->rounds.is_new_round == 1) + { + clear_enemies_ressources(resources); + init_enemies_ressources(renderer,resources,world); + world->rounds.is_new_round = 0; + } + //Les ennemis for (int i = 0; i < world->rounds.number_enemies; i++) { diff --git a/code/round_management.c b/code/round_management.c index 745cc90c56988aa48adf7bc3d33066fdf06e99da..c04d7f7374dd5d54f5042e0743cc3a57150bb9c5 100644 --- a/code/round_management.c +++ b/code/round_management.c @@ -27,7 +27,6 @@ int isRoundEnded(round_t *round) } - void initFirstRound(round_t *round, int nbEnemies, int incrementation) { round->round_number = 0; @@ -35,6 +34,7 @@ void initFirstRound(round_t *round, int nbEnemies, int incrementation) round->incrementation = incrementation; round->counter = 0; round->index_to_spawn = 0; + round->is_new_round = 0; createEnemies(round); } @@ -55,7 +55,14 @@ void updateRound(round_t *round) void nextRound(round_t *round) { - + clearEnemies(round); + round->round_number++; + printf("Manche %d\n",round->round_number); + round->number_enemies = round->number_enemies + round->incrementation; + round->index_to_spawn = 0; + round->counter = 0; + round->is_new_round = 1; + createEnemies(round); } //Créer nbEnemies diff --git a/code/round_management.h b/code/round_management.h index f764ef84087ebcef88a6f40111ae1d5aef6f47e8..2c7766bcdae2e9edacd02367dec91f4d57617725 100644 --- a/code/round_management.h +++ b/code/round_management.h @@ -11,6 +11,7 @@ struct round_s enemy_t *enemies; //Tableau d'ennemis int counter; //Compteur entre chaque apparition des ennemis int index_to_spawn; //Index pour savoir quel ennemi doit apparaitre + int is_new_round; }; /** * \brief Type qui correspond au round diff --git a/code/world_data.c b/code/world_data.c index b74126a7e734cd6b46ea4a00a1088cc52cf64b70..67a0687b6a9f792dc2c85cbcdf30ce38dac02998 100644 --- a/code/world_data.c +++ b/code/world_data.c @@ -24,7 +24,7 @@ void init_data(world_t *world) { //Chargement de la sauvegarde - int incrementation = 3; + int incrementation = 1; int nbEnemis = 4; //Chargement de la première manche