This commit is contained in:
flo 2017-02-07 21:25:33 +01:00
parent d8d12a945e
commit 2806c93173
1 changed files with 16 additions and 21 deletions

View File

@ -15,7 +15,7 @@ void init()
voiture.corridor = 2;
voiture.money = 0;
voiture.essence = 100;
voiture.essence = 20;
voiture.distance = 0;
voiture.life = 1;
voiture.speed = 1;
@ -28,11 +28,6 @@ for(int i = 0; i<4; i++)
}
}
void update_essence()
{
voiture.essence -= 1;
}
int main(void)
{
short menu=0;
@ -112,10 +107,10 @@ dclear();
dimage(voiture.decalx-20, 11*voiture.corridor, &img_formel1);
dprint(1, 1, "%d", compteur);
dprint(40, 1, "%d", voiture.life);
dprint(40, 1, "l %d", voiture.life);
//Jauge d'essence
dline(25+voiture.essence/5, 58, 45, 58, Color_Black);
dline(25+voiture.essence, 58, 45, 58, Color_Black);
dreverse_area(24, 57, 46, 59);
//generation de chacun des obstacles
@ -128,7 +123,7 @@ for(i=0; i<4; i++)
dimage_part(obstacle[i].coordx, 11*i+11, &img_obstacle, 10*obstacle[i].num_obst, 0, 10, 10);
obstacle[i].coordx-=voiture.speed;
obstacle[i].coordx -= voiture.speed;
}
//hit box
@ -136,21 +131,21 @@ if(obstacle[voiture.corridor-1].coordx < voiture.decalx - 2 && obstacle[voiture.
{
switch(obstacle[voiture.corridor-1].num_obst)
{
case 1 : voiture.life --; break;
case 2 : voiture.speed+=1; break;
case 1 : voiture.life--; break;
case 2 : voiture.speed++; break;
case 3 : voiture.speed = (voiture.speed <= 0 ? 1 : voiture.speed + 1); break;
case 4 : voiture.life++; break;
case 5 : voiture.decalx = 74; break;
case 6 : voiture.essence = 100; break;
case 6 : voiture.essence = 20; break;
case 7 : voiture.money++; break;
case 8 : voiture.money+=2; break;
case 8 : voiture.money += 2; break;
}
obstacle[voiture.corridor-1].num_obst = 0;
}
if(compteur%30 == 0 )
if(compteur%60 == 59 )
{
voiture.essence -= 3;
voiture.essence -= 1;
}
if (voiture.essence <= 0)
@ -168,9 +163,9 @@ if (voiture.life <= 0)
}
// dessin des lignes
for(i=1;i<4;i++)
for(i = 1; i < 4 ; i++)
{
for(j=compteur%3;j<128;j+=4)
for(j = compteur%3; j < 128; j += 4)
{
dline(2*j, i*11+10, 2*j+3, i*11+10, Color_Black);
}
@ -194,9 +189,9 @@ unsigned char i, sum;
sum = 0;
i = 0;
while(sum<=alea)
while(sum <= alea)
{
sum+=proba[i];
sum += proba[i];
i++;
}
@ -208,8 +203,8 @@ return;
unsigned short rand(int min, int max)
{
seed+=200;
seed*=seed;
seed += 200;
seed *= seed;
seed = (seed & 0x00FFFF00)>>8;
return seed%(max-min) + min;