Skip to content
Snippets Groups Projects
Commit 7218a941 authored by suck5u's avatar suck5u
Browse files

Optimisation

parent 1bc6543a
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,10 @@ void updateRound(round_t *round) ...@@ -38,7 +38,10 @@ void updateRound(round_t *round)
if(round->counter == 0) if(round->counter == 0)
{ {
round->enemies[round->index_to_spawn].is_moving = 1; 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++; round->counter++;
if(round->counter == 50) if(round->counter == 50)
......
...@@ -87,8 +87,16 @@ void init_data(world_t *world) ...@@ -87,8 +87,16 @@ void init_data(world_t *world)
void refresh_data(world_t *world) void refresh_data(world_t *world)
{ {
//Si la manche n'est pas finie //Si la manche est finie, manche suivante
if(isRoundEnded(&world->rounds) == 0) 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); updateRound(&world->rounds);
for (int i = 0; i < world->rounds.number_enemies ; i++) for (int i = 0; i < world->rounds.number_enemies ; i++)
...@@ -104,14 +112,6 @@ void refresh_data(world_t *world) ...@@ -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 //Les balles
for(int i = 0; i < NB_BULLET; i++) for(int i = 0; i < NB_BULLET; i++)
......
/Vie du joueur au début /Vie du joueur au début
30 10
/Nombre d'ennemis au début /Nombre d'ennemis au début
6 1
/Nombre d'ennemis en plus à chaque manche /Nombre d'ennemis en plus à chaque manche
3 1
/Nombre de balles /Nombre de balles
30 30
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment