Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProgAvancee
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SUCK Hugo
ProgAvancee
Commits
9c33a96b
Commit
9c33a96b
authored
4 years ago
by
suck5u
Browse files
Options
Downloads
Patches
Plain Diff
Gestion des manches avec nombre d'ennemis dynamique
parent
5fb0ae53
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
code/display.c
+7
-0
7 additions, 0 deletions
code/display.c
code/round_management.c
+9
-2
9 additions, 2 deletions
code/round_management.c
code/round_management.h
+1
-0
1 addition, 0 deletions
code/round_management.h
code/world_data.c
+1
-1
1 addition, 1 deletion
code/world_data.c
with
18 additions
and
3 deletions
code/display.c
+
7
−
0
View file @
9c33a96b
...
@@ -86,6 +86,13 @@ void refresh_graphics(SDL_Renderer *renderer, world_t *world,resources_t *resour
...
@@ -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
]);
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
//Les ennemis
for
(
int
i
=
0
;
i
<
world
->
rounds
.
number_enemies
;
i
++
)
for
(
int
i
=
0
;
i
<
world
->
rounds
.
number_enemies
;
i
++
)
{
{
...
...
This diff is collapsed.
Click to expand it.
code/round_management.c
+
9
−
2
View file @
9c33a96b
...
@@ -27,7 +27,6 @@ int isRoundEnded(round_t *round)
...
@@ -27,7 +27,6 @@ int isRoundEnded(round_t *round)
}
}
void
initFirstRound
(
round_t
*
round
,
int
nbEnemies
,
int
incrementation
)
void
initFirstRound
(
round_t
*
round
,
int
nbEnemies
,
int
incrementation
)
{
{
round
->
round_number
=
0
;
round
->
round_number
=
0
;
...
@@ -35,6 +34,7 @@ void initFirstRound(round_t *round, int nbEnemies, int incrementation)
...
@@ -35,6 +34,7 @@ void initFirstRound(round_t *round, int nbEnemies, int incrementation)
round
->
incrementation
=
incrementation
;
round
->
incrementation
=
incrementation
;
round
->
counter
=
0
;
round
->
counter
=
0
;
round
->
index_to_spawn
=
0
;
round
->
index_to_spawn
=
0
;
round
->
is_new_round
=
0
;
createEnemies
(
round
);
createEnemies
(
round
);
}
}
...
@@ -55,7 +55,14 @@ void updateRound(round_t *round)
...
@@ -55,7 +55,14 @@ void updateRound(round_t *round)
void
nextRound
(
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
//Créer nbEnemies
...
...
This diff is collapsed.
Click to expand it.
code/round_management.h
+
1
−
0
View file @
9c33a96b
...
@@ -11,6 +11,7 @@ struct round_s
...
@@ -11,6 +11,7 @@ struct round_s
enemy_t
*
enemies
;
//Tableau d'ennemis
enemy_t
*
enemies
;
//Tableau d'ennemis
int
counter
;
//Compteur entre chaque apparition des ennemis
int
counter
;
//Compteur entre chaque apparition des ennemis
int
index_to_spawn
;
//Index pour savoir quel ennemi doit apparaitre
int
index_to_spawn
;
//Index pour savoir quel ennemi doit apparaitre
int
is_new_round
;
};
};
/**
/**
* \brief Type qui correspond au round
* \brief Type qui correspond au round
...
...
This diff is collapsed.
Click to expand it.
code/world_data.c
+
1
−
1
View file @
9c33a96b
...
@@ -24,7 +24,7 @@ void init_data(world_t *world)
...
@@ -24,7 +24,7 @@ void init_data(world_t *world)
{
{
//Chargement de la sauvegarde
//Chargement de la sauvegarde
int
incrementation
=
3
;
int
incrementation
=
1
;
int
nbEnemis
=
4
;
int
nbEnemis
=
4
;
//Chargement de la première manche
//Chargement de la première manche
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment