diff --git a/code/round_management.c b/code/round_management.c index 0a6b204ad03e1c6b669a9668f31d3e333bc8c007..cd5d04dbc7250b2cbab06d06e88470fe37e0937a 100644 --- a/code/round_management.c +++ b/code/round_management.c @@ -38,7 +38,10 @@ void updateRound(round_t *round) if(round->counter == 0) { round->enemies[round->index_to_spawn].is_moving = 1; - round->index_to_spawn++; + if(round->index_to_spawn+1 < round->number_enemies) + { + round->index_to_spawn++; + } } round->counter++; if(round->counter == 50) diff --git a/code/world_data.c b/code/world_data.c index 6705436ec2c70cd4202ee9c102e069f62c3bcef0..878820162911223ef41b89b74bd2df21e9eff487 100644 --- a/code/world_data.c +++ b/code/world_data.c @@ -87,8 +87,16 @@ void init_data(world_t *world) void refresh_data(world_t *world) { - //Si la manche n'est pas finie - if(isRoundEnded(&world->rounds) == 0) + //Si la manche est finie, manche suivante + if(isRoundEnded(&world->rounds) == 1) + { + //free(world->rounds.enemies); + nextRound(&world->rounds); + //printf("gg ta gagné"); + //Charger le bon nombre de texture + } + //Sinon si la manche n'est pas finie + else { updateRound(&world->rounds); for (int i = 0; i < world->rounds.number_enemies ; i++) @@ -104,14 +112,6 @@ void refresh_data(world_t *world) } } } - //Sinon si la manche est finie, manche suivante - else - { - //free(world->rounds.enemies); - nextRound(&world->rounds); - //printf("gg ta gagné"); - //Charger le bon nombre de texture - } //Les balles for(int i = 0; i < NB_BULLET; i++) diff --git a/data/save.txt b/data/save.txt index 95d14834aaa2dbdfc810d9bbfa929634df4f29ae..e9a03bdfced1713f9b6b517ab7e16a8c5e487287 100644 --- a/data/save.txt +++ b/data/save.txt @@ -1,8 +1,8 @@ /Vie du joueur au début -30 +10 /Nombre d'ennemis au début -6 +1 /Nombre d'ennemis en plus à chaque manche -3 +1 /Nombre de balles 30