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
8bee9081
Commit
8bee9081
authored
4 years ago
by
suck5u
Browse files
Options
Downloads
Patches
Plain Diff
merge
parent
7218a941
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
code/display.c
+7
-3
7 additions, 3 deletions
code/display.c
code/enemy.c
+16
-0
16 additions, 0 deletions
code/enemy.c
code/enemy.h
+2
-0
2 additions, 0 deletions
code/enemy.h
code/world_data.c
+0
-3
0 additions, 3 deletions
code/world_data.c
data/save.txt
+1
-1
1 addition, 1 deletion
data/save.txt
with
26 additions
and
7 deletions
code/display.c
+
7
−
3
View file @
8bee9081
...
@@ -102,14 +102,18 @@ void refresh_graphics(SDL_Renderer *renderer, world_t *world,resources_t *resour
...
@@ -102,14 +102,18 @@ void refresh_graphics(SDL_Renderer *renderer, world_t *world,resources_t *resour
if
(
world
->
rounds
.
enemies
[
i
].
sprite
.
is_visible
==
1
)
if
(
world
->
rounds
.
enemies
[
i
].
sprite
.
is_visible
==
1
)
{
{
/*
if(world->rounds.enemies[i].direction == 1)
if
(
world
->
rounds
.
enemies
[
i
].
direction
==
1
&&
world
->
rounds
.
enemies
[
i
].
isLookingLeft
==
1
)
{
{
rotate_right
(
renderer
,
world
,
resources
->
enemies
[
i
],
i
);
rotate_right
(
renderer
,
world
,
resources
->
enemies
[
i
],
i
);
world
->
rounds
.
enemies
[
i
].
isLookingLeft
=
0
;
world
->
rounds
.
enemies
[
i
].
isLookingRight
=
1
;
}
}
else
else
if
(
world
->
rounds
.
enemies
[
i
].
direction
==
-
1
&&
world
->
rounds
.
enemies
[
i
].
isLookingRight
==
1
)
{
{
rotate_left
(
renderer
,
world
,
resources
->
enemies
[
i
],
i
);
rotate_left
(
renderer
,
world
,
resources
->
enemies
[
i
],
i
);
}*/
world
->
rounds
.
enemies
[
i
].
isLookingLeft
=
1
;
world
->
rounds
.
enemies
[
i
].
isLookingRight
=
0
;
}
load_texture_enemies
(
resources
,
renderer
,
world
,
i
);
load_texture_enemies
(
resources
,
renderer
,
world
,
i
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
code/enemy.c
+
16
−
0
View file @
8bee9081
...
@@ -42,9 +42,13 @@ void init_enemyType1(enemy_t *enemy)
...
@@ -42,9 +42,13 @@ void init_enemyType1(enemy_t *enemy)
{
{
init_sprite
(
&
enemy
->
sprite
,
SCREEN_WIDTH
+
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_SPEED
,
1
);
init_sprite
(
&
enemy
->
sprite
,
SCREEN_WIDTH
+
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_SPEED
,
1
);
enemy
->
direction
=
-
1
;
enemy
->
direction
=
-
1
;
enemy
->
isLookingRight
=
0
;
enemy
->
isLookingLeft
=
1
;
}
else
{
}
else
{
init_sprite
(
&
enemy
->
sprite
,
-
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_SPEED
,
1
);
init_sprite
(
&
enemy
->
sprite
,
-
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_SPEED
,
1
);
enemy
->
direction
=
1
;
enemy
->
direction
=
1
;
enemy
->
isLookingRight
=
1
;
enemy
->
isLookingLeft
=
0
;
}
}
enemy
->
type
=
1
;
enemy
->
type
=
1
;
enemy
->
DestEnemy
.
x
=
enemy
->
sprite
.
x
;
enemy
->
DestEnemy
.
x
=
enemy
->
sprite
.
x
;
...
@@ -60,9 +64,13 @@ void init_enemyType2(enemy_t *enemy)
...
@@ -60,9 +64,13 @@ void init_enemyType2(enemy_t *enemy)
{
{
init_sprite
(
&
enemy
->
sprite
,
SCREEN_WIDTH
+
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_T2_SPEED
,
2
);
init_sprite
(
&
enemy
->
sprite
,
SCREEN_WIDTH
+
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_T2_SPEED
,
2
);
enemy
->
direction
=
-
1
;
enemy
->
direction
=
-
1
;
enemy
->
isLookingRight
=
0
;
enemy
->
isLookingLeft
=
1
;
}
else
{
}
else
{
init_sprite
(
&
enemy
->
sprite
,
-
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_T2_SPEED
,
2
);
init_sprite
(
&
enemy
->
sprite
,
-
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_T2_SPEED
,
2
);
enemy
->
direction
=
1
;
enemy
->
direction
=
1
;
enemy
->
isLookingRight
=
1
;
enemy
->
isLookingLeft
=
0
;
}
}
enemy
->
type
=
2
;
enemy
->
type
=
2
;
enemy
->
DestEnemy
.
x
=
enemy
->
sprite
.
x
;
enemy
->
DestEnemy
.
x
=
enemy
->
sprite
.
x
;
...
@@ -78,9 +86,13 @@ void init_enemyType3(enemy_t *enemy)
...
@@ -78,9 +86,13 @@ void init_enemyType3(enemy_t *enemy)
{
{
init_sprite
(
&
enemy
->
sprite
,
SCREEN_WIDTH
+
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_T3_SPEED
,
1
);
init_sprite
(
&
enemy
->
sprite
,
SCREEN_WIDTH
+
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_T3_SPEED
,
1
);
enemy
->
direction
=
-
1
;
enemy
->
direction
=
-
1
;
enemy
->
isLookingRight
=
0
;
enemy
->
isLookingLeft
=
1
;
}
else
{
}
else
{
init_sprite
(
&
enemy
->
sprite
,
-
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_T3_SPEED
,
1
);
init_sprite
(
&
enemy
->
sprite
,
-
75
,
SCREEN_HEIGHT
-
ENEMY_HEIGHT
*
2
-
20
,
ENEMY_WIDTH
,
ENEMY_HEIGHT
,
ENEMY_T3_SPEED
,
1
);
enemy
->
direction
=
1
;
enemy
->
direction
=
1
;
enemy
->
isLookingRight
=
1
;
enemy
->
isLookingLeft
=
0
;
}
}
enemy
->
type
=
3
;
enemy
->
type
=
3
;
enemy
->
DestEnemy
.
x
=
enemy
->
sprite
.
x
;
enemy
->
DestEnemy
.
x
=
enemy
->
sprite
.
x
;
...
@@ -96,9 +108,13 @@ void init_enemyType4(enemy_t *enemy)
...
@@ -96,9 +108,13 @@ void init_enemyType4(enemy_t *enemy)
{
{
init_sprite
(
&
enemy
->
sprite
,
SCREEN_WIDTH
+
75
,
SCREEN_HEIGHT
-
ENEMY_T4_HEIGHT
*
2
-
40
,
ENEMY_T4_WIDTH
,
ENEMY_T4_HEIGHT
,
1
,
1
);
init_sprite
(
&
enemy
->
sprite
,
SCREEN_WIDTH
+
75
,
SCREEN_HEIGHT
-
ENEMY_T4_HEIGHT
*
2
-
40
,
ENEMY_T4_WIDTH
,
ENEMY_T4_HEIGHT
,
1
,
1
);
enemy
->
direction
=
-
1
;
enemy
->
direction
=
-
1
;
enemy
->
isLookingRight
=
0
;
enemy
->
isLookingLeft
=
1
;
}
else
{
}
else
{
init_sprite
(
&
enemy
->
sprite
,
-
75
,
SCREEN_HEIGHT
-
ENEMY_T4_HEIGHT
*
2
-
40
,
ENEMY_T4_WIDTH
,
ENEMY_T4_HEIGHT
,
1
,
1
);
init_sprite
(
&
enemy
->
sprite
,
-
75
,
SCREEN_HEIGHT
-
ENEMY_T4_HEIGHT
*
2
-
40
,
ENEMY_T4_WIDTH
,
ENEMY_T4_HEIGHT
,
1
,
1
);
enemy
->
direction
=
1
;
enemy
->
direction
=
1
;
enemy
->
isLookingRight
=
1
;
enemy
->
isLookingLeft
=
0
;
}
}
enemy
->
type
=
4
;
enemy
->
type
=
4
;
enemy
->
DestEnemy
.
x
=
enemy
->
sprite
.
x
;
enemy
->
DestEnemy
.
x
=
enemy
->
sprite
.
x
;
...
...
This diff is collapsed.
Click to expand it.
code/enemy.h
+
2
−
0
View file @
8bee9081
...
@@ -19,6 +19,8 @@ struct enemy_s{
...
@@ -19,6 +19,8 @@ struct enemy_s{
int
drop
;
int
drop
;
powerUP_t
powerUP
;
powerUP_t
powerUP
;
int
direction
;
int
direction
;
int
isLookingRight
;
int
isLookingLeft
;
};
};
/**
/**
* \brief Type qui correspond au paramètre du soldat
* \brief Type qui correspond au paramètre du soldat
...
...
This diff is collapsed.
Click to expand it.
code/world_data.c
+
0
−
3
View file @
8bee9081
...
@@ -90,10 +90,7 @@ void refresh_data(world_t *world)
...
@@ -90,10 +90,7 @@ void refresh_data(world_t *world)
//Si la manche est finie, manche suivante
//Si la manche est finie, manche suivante
if
(
isRoundEnded
(
&
world
->
rounds
)
==
1
)
if
(
isRoundEnded
(
&
world
->
rounds
)
==
1
)
{
{
//free(world->rounds.enemies);
nextRound
(
&
world
->
rounds
);
nextRound
(
&
world
->
rounds
);
//printf("gg ta gagné");
//Charger le bon nombre de texture
}
}
//Sinon si la manche n'est pas finie
//Sinon si la manche n'est pas finie
else
else
...
...
This diff is collapsed.
Click to expand it.
data/save.txt
+
1
−
1
View file @
8bee9081
/Vie du joueur au début
/Vie du joueur au début
10
10
/Nombre d'ennemis au début
/Nombre d'ennemis au début
1
5
/Nombre d'ennemis en plus à chaque manche
/Nombre d'ennemis en plus à chaque manche
1
1
/Nombre de balles
/Nombre de balles
...
...
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