From fb232ead3155db8c7c04d80da0834b3c13e47610 Mon Sep 17 00:00:00 2001 From: brigitte Date: Mon, 11 Dec 2023 14:42:47 +0100 Subject: [PATCH] systeme d'acceleration en fonction du nombre de pomme --- JEUX_SERPENT/Jeux | Bin 22048 -> 22120 bytes JEUX_SERPENT/fonction.h | 1 + JEUX_SERPENT/main.c | 1 + JEUX_SERPENT/serpent.c | 5 ++++- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/JEUX_SERPENT/Jeux b/JEUX_SERPENT/Jeux index b60735fdb4ec2669272a38483f687971166c6458..a13105dfbd036740852e6c786cf184f0dd7149b3 100755 GIT binary patch delta 4052 zcmZWsYgAO%6~1Sf!%JQRGYo?$j}--tf`~8h1p+b}VgR)St5MW0HTe;V(CDf*7_?!K6miHrm#zNopN~8nvxXlFIbk=iZs> zn}eRNNfBewv-O^QeNaeRgf9#~ND46Xk51ApN;|ka@Q66WBKOLbc z8hb&MPfLvu8{^Vgyl9C_j=guD;@^a9@YK`|aq(-SKQ4jwiyLvn9TTT3%JeskisBfe z@(e5*JaLY27jK@XC8Bb%T!Nb;RsIIl>H7_evKfpQbw<;Y-!HT~uc?-U093vovcTEz z>_*|OLy@ktrz04#uzVLLyVIp5d-4ab_k>YwHCM7MaoIf5kwDf)9w&WV?o+Tk`RnH- zI7A1JN-#%y-b3iIyCfq9eqlo$2HKS zgOen&gD@@>;PZryQ%U{ELpe8vj8|hce>mkeed<6 z>(c(*P1VvO`8KTCS^GQoM)MX5ho%fCj|hWmc_kjSR$6io73zc=&avJ)~-O-{yb3~AD1lPC4;>LLPHmG@->pbf+W8o`r^li zyx33mE)oBYpKKV_FQSr?3`6_Hd~2rRZ)a$=_|_Q&nP5=)Q7DfUa~^tAZ?6pl>y74r1 zT~P)qR9*}HvFf$~kku{HE&l2jl7*@(f+DMHpq+U(ma@7GBJeaZGch%!YZB=v#Hz&X zax?S>kFhqw#W_?ueg=wE{%|6}K?L81ig#EU7_0JsO4vZ~1*oV{8HiW;840sm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/fonction.h +++ b/JEUX_SERPENT/fonction.h @@ -14,6 +14,7 @@ extern unsigned long int suivant; extern int serpent, tete_up, tete_down, tete_right, tete_left, queue_up, queue_down, queue_left, queue_right; extern int x, y, direction, t, segment, i; extern int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400]; +extern long int vitesse; extern int p, pp, pomme, pommex[5], pommey[5]; extern int fond, Nbr; diff --git a/JEUX_SERPENT/main.c b/JEUX_SERPENT/main.c index f877b2e..7d304a1 100644 --- a/JEUX_SERPENT/main.c +++ b/JEUX_SERPENT/main.c @@ -10,6 +10,7 @@ int seconde=0, minute=0, seconde_actuel, old_seconde; char timer[6]; unsigned long int suivant; +long int vitesse=100000; int serpent; int x=500, y=360, direction=4 /*1 : vers le haut, 2 : vers le bas, 3 vers la gauche, 4 vers la droite*/, t, segment=10, i=0; diff --git a/JEUX_SERPENT/serpent.c b/JEUX_SERPENT/serpent.c index f6b7228..37b0ecd 100644 --- a/JEUX_SERPENT/serpent.c +++ b/JEUX_SERPENT/serpent.c @@ -54,12 +54,15 @@ void Serpent(){ segment+=2; pommex[p] = ((rand() % (58)+1)*20); pommey[p] = ((rand() % (34)+1)*20); + if (vitesse>20000){ + vitesse=vitesse-1500; + } } } Update_Serpent(); Terrain(); - usleep(100000); + usleep(vitesse); } /*fonction pour mettre à jour la position du serpent*/