Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SpaceInvaders_upgrade
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lila NICKLER
SpaceInvaders_upgrade
Commits
3432c1c6
Commit
3432c1c6
authored
Oct 30, 2020
by
Lila NICKLER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout music de fond
parent
933ba8b1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
2 deletions
+12
-2
music.mp3
music.mp3
+0
-0
space_invaders.c
space_invaders.c
+12
-2
space_invaders.exe
space_invaders.exe
+0
-0
storage.data
storage.data
+0
-0
No files found.
music.mp3
0 → 100644
View file @
3432c1c6
File added
space_invaders.c
View file @
3432c1c6
...
@@ -75,6 +75,8 @@ typedef struct Item{
...
@@ -75,6 +75,8 @@ typedef struct Item{
static
const
int
screenWidth
=
800
;
static
const
int
screenWidth
=
800
;
static
const
int
screenHeight
=
450
;
static
const
int
screenHeight
=
450
;
static
Music
music
;
static
bool
gameOver
=
false
;
static
bool
gameOver
=
false
;
static
bool
pause
=
false
;
static
bool
pause
=
false
;
static
int
score
=
0
;
static
int
score
=
0
;
...
@@ -112,6 +114,10 @@ int main(void)
...
@@ -112,6 +114,10 @@ int main(void)
// Initialization (Note windowTitle is unused on Android)
// Initialization (Note windowTitle is unused on Android)
//---------------------------------------------------------
//---------------------------------------------------------
InitWindow
(
screenWidth
,
screenHeight
,
"sample game: space invaders"
);
InitWindow
(
screenWidth
,
screenHeight
,
"sample game: space invaders"
);
InitAudioDevice
();
music
=
LoadMusicStream
(
"music.mp3"
);
PlayMusicStream
(
music
);
InitGame
();
InitGame
();
...
@@ -133,6 +139,8 @@ int main(void)
...
@@ -133,6 +139,8 @@ int main(void)
// De-Initialization
// De-Initialization
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
UnloadGame
();
// Unload loaded data (textures, sounds, models...)
UnloadGame
();
// Unload loaded data (textures, sounds, models...)
UnloadMusicStream
(
music
);
// Unload music stream buffers from RAM
CloseWindow
();
// Close window and OpenGL context
CloseWindow
();
// Close window and OpenGL context
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
...
@@ -159,6 +167,7 @@ void InitGame(void)
...
@@ -159,6 +167,7 @@ void InitGame(void)
score
=
0
;
score
=
0
;
alpha
=
0
;
alpha
=
0
;
highscore
=
LoadStorageValue
(
0
);
highscore
=
LoadStorageValue
(
0
);
PlayMusicStream
(
music
);
// Initialize player
// Initialize player
player
.
rec
.
x
=
20
;
player
.
rec
.
x
=
20
;
...
@@ -236,6 +245,8 @@ void UpdateGame(void)
...
@@ -236,6 +245,8 @@ void UpdateGame(void)
{
{
if
(
!
gameOver
)
if
(
!
gameOver
)
{
{
UpdateMusicStream
(
music
);
if
(
IsKeyPressed
(
'P'
))
pause
=
!
pause
;
if
(
IsKeyPressed
(
'P'
))
pause
=
!
pause
;
if
(
!
pause
)
if
(
!
pause
)
...
@@ -407,8 +418,7 @@ void UpdateGame(void)
...
@@ -407,8 +418,7 @@ void UpdateGame(void)
enemy
[
i
].
rec
.
x
=
GetRandomValue
(
screenWidth
,
screenWidth
+
1000
);
enemy
[
i
].
rec
.
x
=
GetRandomValue
(
screenWidth
,
screenWidth
+
1000
);
enemy
[
i
].
rec
.
y
=
GetRandomValue
(
0
,
screenHeight
-
enemy
[
i
].
rec
.
height
);
enemy
[
i
].
rec
.
y
=
GetRandomValue
(
0
,
screenHeight
-
enemy
[
i
].
rec
.
height
);
player
.
life
--
;
player
.
life
--
;
}
}
// Perte du bonus
// Perte du bonus
player
.
speed
.
x
=
5
;
player
.
speed
.
x
=
5
;
...
...
space_invaders.exe
0 → 100644
View file @
3432c1c6
File added
storage.data
0 → 100644
View file @
3432c1c6
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment