From 8f5e06d9c6f2f96a7bdbf18ba556dea1dd9fc05a Mon Sep 17 00:00:00 2001 From: brigitte Date: Mon, 18 Dec 2023 13:36:17 +0100 Subject: [PATCH] enlevement des extern 1 --- JEUX_SERPENT/Jeux | Bin 22216 -> 22168 bytes JEUX_SERPENT/fonction.h | 9 +++------ JEUX_SERPENT/main.c | 4 ++-- JEUX_SERPENT/scene.c | 10 ++++------ JEUX_SERPENT/serpent.c | 20 +++++--------------- JEUX_SERPENT/timer.c | 1 + 6 files changed, 15 insertions(+), 29 deletions(-) diff --git a/JEUX_SERPENT/Jeux b/JEUX_SERPENT/Jeux index ce0df467703c0c729129b4598a709abecb185c85..0a5d2043bd48bc6237bbaebcc5f2de4d34dddd7e 100755 GIT binary patch delta 5102 zcmaJ_dw5jU5x@5)Cy*FfHY9A;07;PWuq9*z7~Um@O_ql|O$rexiXezWMQHq5aKZ4} z?+QeYTBJ|`3+02)imnepnuN7)%&Ybzp z%$b=xXU_Td&^z+_cjT(>a{8-1zDzopB8lI@6rLjICN;zv%Z51r2su}_dtAmkGIO7z zr=I<&YV?4fyIOs7f8QQA2ArGME7b0ce`DOaHu8hKBITwsBZ1Fq*LiSdvLx*xeXY2S zMTPFOs12LVseDhm&iq~)~>Hyaw$c(C2uUQgw2F zM0F|&(4dVZC0&xdQZ+`Yh6b&hspTatDA88;iLCV#02&?;K4|Y_>0=E8 zh4f96xk)e|KP8x7o6J>$S$9$}>kOt>dqHqd8r&~U(W!#@H-mZJWDXb1U0|A-3LS<& zYTADXV04G)9J;2m>!9TWDw_d+e8-W2hP%2>;0b^y0Ip6}u=K3=tWI4HZ7;<*j)cKy zACRTeuxI)y&+6pY0Rv6*PXiinkJcikjbN+s%01%CcC{!@jv|12V0`1AqENA{{|K$zb) zHkIQ6p%JKl3Q$czMzqVL(DzNW0YJ?LLZ6O8{U%yPXlFu)1Ff3k749@`De|se07gkJ zqj@zOD3pWRN-TYBobYsHtfwOY#@czqv~%N5QxxUVQ8akTm0G|myL}u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9SWsUW3}_J27^9 zKi*p4)^-o`*>69g@prYsJhiYvt@rIM9ItAlQhDbctB33!Mo}WyC78)dg0f|(g-znm z7Hv=J!H++>#0sIG%#&;`^#*=qs*Ag)q^fWF%BL(>ok>cXvgli(#HXco#q+|cuB1UI zox(0jvCuYt>CViYQ4(FAWuc;en0dgHv{a>Gx`l_@LW)&PTZ3lW6E)MbGTO0pOD}E* z%u=bJ9i^YkUzzGEUnbe6DE1MFPmaPXCB8HYuLe#PelXaYUEFM#Uan4arEQg7i8CxV zv^uZxoM|rgEvidx z0>6Z;$|c)3Dyyr)SHp}+N~-d*ybGboc0R-HN^?lINwT4eT>M$LOFbzn%H(^Y94VE1 zqLgF!X|Q(-HcgoxmEkO&RP0Kd2bQYtlvTeet6RO?C1>b?4PuE(B9~)|o zk6WEmLo=!kV&0u{-pManpb8Xe*Jv&P$V?y*J#R9<~=#(x0@7-1y< diff --git a/JEUX_SERPENT/fonction.h b/JEUX_SERPENT/fonction.h index c57c78d..ef23482 100644 --- a/JEUX_SERPENT/fonction.h +++ b/JEUX_SERPENT/fonction.h @@ -4,19 +4,16 @@ #include #include - -extern long int attendre; - extern int seconde, minute, seconde_actuel, old_seconde; extern char timer[6]; 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, t4, segment, i; +extern int serpent, tete_up, tete_down, tete_right, tete_left; +extern int x, y, direction,segment; 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 pomme, pommex[5], pommey[5]; extern int fond, Nbr; extern char score[4]; diff --git a/JEUX_SERPENT/main.c b/JEUX_SERPENT/main.c index 6060de0..0819965 100644 --- a/JEUX_SERPENT/main.c +++ b/JEUX_SERPENT/main.c @@ -15,7 +15,7 @@ int x=500, y=360, direction=4 /*1 : vers le haut, 2 : vers le bas, 3 vers la gau int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400]; int tete_up, tete_down, tete_right, tete_left, queue_up, queue_down, queue_left, queue_right; -int p=0, pp=0, pomme, pommex[5], pommey[5]; +int pomme, pommex[5], pommey[5]; int fond, Nbr; char score[4]; @@ -26,7 +26,7 @@ int imageMenu; int go_menu2=1; int t2; int t3; -int t4; + /*Fonction Principale*/ int main(){ diff --git a/JEUX_SERPENT/scene.c b/JEUX_SERPENT/scene.c index 588266a..f7ea919 100644 --- a/JEUX_SERPENT/scene.c +++ b/JEUX_SERPENT/scene.c @@ -12,6 +12,8 @@ void Terrain(){ /*Fonction Pour créer la première scene du jeu*/ void DessinerScene(){ + int p=0; + int i=0; snprintf(timer,6,"%02d:%02d", minute, seconde); ChoisirCouleurDessin(CouleurParComposante(5,130,4)); RemplirRectangle(20,20,1160,680); @@ -23,12 +25,7 @@ void DessinerScene(){ tete_down =ChargerSprite("IMG/tete_down.png"); tete_left = ChargerSprite("IMG/tete_left.png"); tete_right = ChargerSprite("IMG/tete_right.png"); - queue_up = ChargerSprite("IMG/queue_up.png"); - queue_down = ChargerSprite("IMG/queue_down.png"); - queue_left = ChargerSprite("IMG/queue_left.png"); - queue_right = ChargerSprite("IMG/queue_right.png"); - - + for (i = 0; i < segment; i++){ AfficherSprite(serpent, x-(i*20), y); pos_x[i]=x-(i*20); @@ -71,6 +68,7 @@ void MenuDeFin(){ /*Apparition aléatoire des pommes*/ void Pomme(){ + int pp=0; for (pp = 0; pp < 5; ++pp) { AfficherSprite(pomme, pommex[pp], pommey[pp]); } diff --git a/JEUX_SERPENT/serpent.c b/JEUX_SERPENT/serpent.c index 28f0d3a..6f9ff87 100644 --- a/JEUX_SERPENT/serpent.c +++ b/JEUX_SERPENT/serpent.c @@ -5,6 +5,7 @@ /*Input Serpent*/ void Controle(){ + int t; while(ToucheEnAttente()){ t = Touche(); switch(t){ @@ -45,7 +46,8 @@ void Controle(){ } /*Avancement automatique du serpent en fonction de la direction*/ -void Serpent(){ +void Serpent(){ + int p=0; if (direction == 1){ pos_y[0]=old_y[0]-20; } @@ -77,7 +79,7 @@ void Serpent(){ /*fonction pour mettre à jour la position du serpent*/ void Update_Serpent(){ - + int i=1; AfficherSprite(fond, pos_x[segment-1], pos_y[segment-1]); /*affichage de la tete en fonction de la direction du serpent*/ if (direction==1){ @@ -99,19 +101,6 @@ void Update_Serpent(){ pos_y[i]=old_y[i-1]; AfficherSprite(serpent, pos_x[i], pos_y[i]); } - /*affichage de la queue*/ - /*if (direction==1){ - AfficherSprite(queue_up, pos_x[segment], pos_y[segment-1]); - } - if (direction==2){ - AfficherSprite(queue_down, pos_x[segment-1], pos_y[segment-1]); - } - if (direction==3){ - AfficherSprite(queue_left, pos_x[segment-1], pos_y[segment-1]); - } - if (direction==4){ - AfficherSprite(queue_right, pos_x[segment-1],pos_y[segment-1]); - }*/ ChoisirCouleurDessin(CouleurParComposante(0,0,0)); RemplirRectangle(0,0,20,20); @@ -127,6 +116,7 @@ void Update_Serpent(){ /*Fonction pour détécter si le serpent se touche lui même*/ void Collision(){ + int i=1; if(seconde!=0 || minute!=0){ for(i=1; i