ajout du score
This commit is contained in:
parent
766b98d8dd
commit
c0bd9eca99
12
main.c
12
main.c
@ -16,9 +16,10 @@
|
|||||||
#define delta 100000L
|
#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 buf[100];
|
||||||
|
char buff[100];
|
||||||
couleur j;
|
couleur j;
|
||||||
j=CouleurParNom("yellow");
|
j=CouleurParNom("yellow");
|
||||||
ChoisirCouleurDessin(j);
|
ChoisirCouleurDessin(j);
|
||||||
@ -26,9 +27,9 @@ void Affichertimer(int n) /*Afficher le temps passé*/
|
|||||||
ChoisirEcran(1);
|
ChoisirEcran(1);
|
||||||
CopierZone(2,1,0,0,930,710,0,0);
|
CopierZone(2,1,0,0,930,710,0,0);
|
||||||
snprintf(buf,100,"temps : %05d",n);
|
snprintf(buf,100,"temps : %05d",n);
|
||||||
TailleSupPolice(7);
|
snprintf(buff,100,"SCORE : %07d",score);
|
||||||
EcrireTexte(60,650,buf,2);
|
EcrireTexte(60,650,buf,2);
|
||||||
TailleSupPolice(7);
|
EcrireTexte(600,650,buff,2);
|
||||||
CopierZone(1,0,0,0,930,710,0,0);
|
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 main()
|
||||||
{
|
{
|
||||||
|
int score =0;
|
||||||
unsigned long suivant;
|
unsigned long suivant;
|
||||||
int go_on=1;
|
int go_on=1;
|
||||||
int x_pastille,y_pastille;
|
int x_pastille,y_pastille;
|
||||||
@ -246,9 +248,11 @@ int main()
|
|||||||
if (Microsecondes()>suivant)
|
if (Microsecondes()>suivant)
|
||||||
{
|
{
|
||||||
n++;
|
n++;
|
||||||
Affichertimer(n);
|
Affichertimeretscore(n,score);
|
||||||
|
|
||||||
suivant=Microsecondes()+delta;
|
suivant=Microsecondes()+delta;
|
||||||
DeplacementSerpent(direction,serpent,longueur_serpent);
|
DeplacementSerpent(direction,serpent,longueur_serpent);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
prog
BIN
prog
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user