Commit f3151ebd authored by Pierre MARQUE's avatar Pierre MARQUE

Rendu final

parent cd4f5c83
...@@ -241,7 +241,7 @@ void UpdateGame(void) ...@@ -241,7 +241,7 @@ void UpdateGame(void)
{ {
paratrooper[i] = InitializeParatrooper(); paratrooper[i] = InitializeParatrooper();
life--; life--;
gameOver = (life == 0); gameOver = (life <= 0);
} }
} }
...@@ -339,8 +339,9 @@ void UpdateGame(void) ...@@ -339,8 +339,9 @@ void UpdateGame(void)
DrawCircleLines(bullet[j].position.x+4,bullet[j].position.y, 10, YELLOW); DrawCircleLines(bullet[j].position.x+4,bullet[j].position.y, 10, YELLOW);
DrawCircleLines(bullet[j].position.x+8,bullet[j].position.y, 5, RED); DrawCircleLines(bullet[j].position.x+8,bullet[j].position.y, 5, RED);
paratrooper[i].life--; paratrooper[i].life--;
Vector2 v = bullet[j].position; Vector2 vbullet = bullet[j].position;
bullet[j].ammoShot = false; float rbullet = bullet[j].radius;
bullet[j] = InitializeBullet();
//Kill paras //Kill paras
if(paratrooper[i].life == 0) if(paratrooper[i].life == 0)
{ {
...@@ -351,7 +352,7 @@ void UpdateGame(void) ...@@ -351,7 +352,7 @@ void UpdateGame(void)
{ {
if(paratrooper[s].droped) if(paratrooper[s].droped)
{ {
if(CheckCollisionCircleRec(v, bullet[j].radius+20, paratrooper[s].hitbox)) if(CheckCollisionCircleRec(vbullet, rbullet+20, paratrooper[s].hitbox))
{ {
paratrooper[s].life--; paratrooper[s].life--;
//Kill paras //Kill paras
...@@ -375,16 +376,15 @@ void UpdateGame(void) ...@@ -375,16 +376,15 @@ void UpdateGame(void)
{ {
if(CheckCollisionCircleRec(bombshells[j].position, bombshells[j].radius, aircraft[i].hitbox)) if(CheckCollisionCircleRec(bombshells[j].position, bombshells[j].radius, aircraft[i].hitbox))
{ {
bombshells[j].ammoShot = false;
DrawCircle(bombshells[j].position.x,bombshells[j].position.y, 15, RED); DrawCircle(bombshells[j].position.x,bombshells[j].position.y, 15, RED);
DrawCircle(bombshells[j].position.x+4,bombshells[j].position.y, 10, YELLOW); DrawCircle(bombshells[j].position.x+4,bombshells[j].position.y, 10, YELLOW);
aircraft[i].life = aircraft[i].life - 1; aircraft[i].life = aircraft[i].life - 1;
PlaySound(soundExplosion); PlaySound(soundExplosion);
bombshells[j] = InitializeBombshell();
//Kill aircrafts //Kill aircrafts
if(aircraft[i].life == 0) if(aircraft[i].life == 0)
{ {
score+=50; score+=50;
DrawCircle(aircraft[i].hitbox.x,aircraft[i].hitbox.y, 15, WHITE); DrawCircle(aircraft[i].hitbox.x,aircraft[i].hitbox.y, 15, WHITE);
DrawCircle(aircraft[i].hitbox.x+4,aircraft[i].hitbox.y, 10, YELLOW); DrawCircle(aircraft[i].hitbox.x+4,aircraft[i].hitbox.y, 10, YELLOW);
DrawCircle(aircraft[i].hitbox.x+8,aircraft[i].hitbox.y, 5, RED); DrawCircle(aircraft[i].hitbox.x+8,aircraft[i].hitbox.y, 5, RED);
...@@ -577,13 +577,13 @@ Aircraft InitializeAircraft(void) ...@@ -577,13 +577,13 @@ Aircraft InitializeAircraft(void)
{ {
aircraft.hitbox.x = -GetRandomValue(0,300); aircraft.hitbox.x = -GetRandomValue(0,300);
aircraft.speed.x = 0.5+ 0.5*((float) GetRandomValue(0,1)); aircraft.speed.x = 0.5+ 0.5*((float) GetRandomValue(0,1));
aircraft.xFirstToJump = GetRandomValue(80,screenWidth/2); aircraft.xFirstToJump = GetRandomValue(90,screenWidth/2);
} }
else else
{ {
aircraft.speed.x = -(0.5+ 0.5*((float) GetRandomValue(0,1))); aircraft.speed.x = -(0.5+ 0.5*((float) GetRandomValue(0,1)));
aircraft.hitbox.x = GetRandomValue(screenWidth,screenWidth+300); aircraft.hitbox.x = GetRandomValue(screenWidth,screenWidth+300);
aircraft.xFirstToJump = GetRandomValue(screenWidth/2,screenWidth-80); aircraft.xFirstToJump = GetRandomValue(screenWidth/2,screenWidth-90);
} }
aircraft.speed.y = 0; aircraft.speed.y = 0;
aircraft.color = GRAY; aircraft.color = GRAY;
......
No preview for this file type
...@@ -13,7 +13,6 @@ typedef struct Paratrooper ...@@ -13,7 +13,6 @@ typedef struct Paratrooper
Rectangle hitbox; Rectangle hitbox;
Vector2 speed; Vector2 speed;
Color color; // yellow or red Color color; // yellow or red
Rectangle drag[10];
}Paratrooper; }Paratrooper;
typedef struct Aircraft typedef struct Aircraft
...@@ -75,7 +74,6 @@ typedef struct Viewfinder ...@@ -75,7 +74,6 @@ typedef struct Viewfinder
float radius; float radius;
Vector2 center; Vector2 center;
Color color; Color color;
}Viewfinder; }Viewfinder;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment