ajout du score

This commit is contained in:
David AKAGUNDUZ 2023-11-29 22:12:33 +01:00
parent 766b98d8dd
commit c0bd9eca99
2 changed files with 8 additions and 4 deletions

12
main.c

@ -16,9 +16,10 @@
#define delta 100000L
void Affichertimer(int n) /*Afficher le temps passé*/
void Affichertimeretscore(int n,int score) /*Afficher le temps passé et le score*/
{
char buf[100];
char buff[100];
couleur j;
j=CouleurParNom("yellow");
ChoisirCouleurDessin(j);
@ -26,9 +27,9 @@ void Affichertimer(int n) /*Afficher le temps passé*/
ChoisirEcran(1);
CopierZone(2,1,0,0,930,710,0,0);
snprintf(buf,100,"temps : %05d",n);
TailleSupPolice(7);
snprintf(buff,100,"SCORE : %07d",score);
EcrireTexte(60,650,buf,2);
TailleSupPolice(7);
EcrireTexte(600,650,buff,2);
CopierZone(1,0,0,0,930,710,0,0);
}
@ -191,6 +192,7 @@ void InitialisationDuSerpent(int *p_serpent) /* L'initialisation du serpent */
int main()
{
int score =0;
unsigned long suivant;
int go_on=1;
int x_pastille,y_pastille;
@ -246,9 +248,11 @@ int main()
if (Microsecondes()>suivant)
{
n++;
Affichertimer(n);
Affichertimeretscore(n,score);
suivant=Microsecondes()+delta;
DeplacementSerpent(direction,serpent,longueur_serpent);
}
}

BIN
prog

Binary file not shown.