From 0c8d66b258e9d97480c7f8929893af8572e31efa Mon Sep 17 00:00:00 2001 From: brigitte Date: Tue, 19 Dec 2023 12:46:10 +0100 Subject: [PATCH] enlevement extern 4 --- JEUX_SERPENT/Jeux | Bin 21896 -> 21968 bytes JEUX_SERPENT/fonction.h | 2 +- JEUX_SERPENT/main.c | 4 ++++ JEUX_SERPENT/serpent.c | 15 +++++++++------ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/JEUX_SERPENT/Jeux b/JEUX_SERPENT/Jeux index 1c0c84f2a6093cf481d64480f8f821e47f45a4dc..c07a3bb1351e1a25e46e779eedee8dc1c4476742 100755 GIT binary patch delta 5831 zcmZu#3tUuH8ozhoDuW;lG7h68pt**nJbYz>fC>)y0u|G=EnnqxTMH^H8;vx_D;soj zv$FkZ4W#;QT=vyjJBE1O{5rgmdjtRuqLN`IY!cT}c?zM<`l%v8h8 zzN0b}WdQ}%+{n^xx8^M#sVJ8p7#I=vESXkZrRl?gaFuGQM235d>@Hm!2#{-aZIRVH z9TB&ZaPLbByp`jJSlCWmtmR5NJ7T+~{~;(S#e)i6CF!4}W9ssJR}}8j)7OA++H1iw z=9;EiuWe$HQPXV=-MxzvXxQs@q1K7Y0%op5S}uDYxvDH zSJxKr(Y0n)8#OfKD#Qr&0&9yJ<=%{ifK7&O^UF}vwG1#l4aR2F+M}fkcpoBQK8Ou- zd9-LOb*;MqJ_ew!Ik715s>RcVz2(>mF-z;}n|ngVt9X)U}8?ocVOP zt_5S7zTKiIPXiIerbYL5#{#EoJuqf@8a?mftn}|mnb%d*DaNu3L@26oKkZl3JV3Xx z`WXy0bZ3kxghW+e1lfKvet^QMjwS#NhK-a=%&KXqp~3hPJW_HGAuTA8t1TmhXD`+@ z)DDc!1S{2E@4;g*7GUYo))A~!drdN@aAwm9&fFlGBRTVN!7P)^M9zFrFiSZzufd4s z+=6*@!4|!+)iw7MS83P=!MFF>2}8lQK=^u=)!i|r z2-*;qWVfoi_S0}h8J^u5u|5SStcKLZ<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56qoN|jsc_N;DfY2bhf37QEqCOAoc%Y6@!W_UMwfl5PN#v6-9 z=GEOmB%@CcYk!`IwDQ2`8xEvpMYF|`(|2XuuCgJ%#DJnEg=NuiENqF=_O)p?Ln>{i zSr2g)(ttejt!dhEti9iv<{-$)r;rQee<11WtDj+-HIP-1^^m7do902t*W2L_=|EO? z)4^36z4iSQpJNGHvIXL zUCqf=>)Ghs6m?0%jNEk9AuUQ>!>f5Qs+z~PLjKXxYbA5#_?{?)0~Mso)Z369+m7c ztX0yw^haUEb>q(pis0KItwTbrTY<;YddtzJlkzT8k^N_sz2{rXFN7n|=0`%#51Tq$0p>ugsMmry}3(vEY6WnT$vhv-E zInf+Hm2;5;D}R!{ZPHgBePsiAd3H(bGa-4t!^&VCE3HPzxbJb_L)@CEtP6>Jm>tF{ zeZf?}+w-;Lyb%&%BhUF1thB$O^F1TIHiURxA+JC@W=d;oFA=L|ouy>C0`GVQzEuci zu;eR}Z>@k&@{Q zC3=<|#>$G*9rY5eXIqL#Ilh#=FWG5$SS7AoGG9qR^|GBM={Nsz=oC?hvkN8Z4y)jl zv%#ek)ofN)3MRf_=&|HVwi9TpL@k-zaG^9;RW~r-lyrx6S8Le9DY@!ywuQH+r{p@$ e=kZv|V&CV=$)G+dI`)|obrEra~0nJ diff --git a/JEUX_SERPENT/fonction.h b/JEUX_SERPENT/fonction.h index 66cf829..159dab4 100644 --- a/JEUX_SERPENT/fonction.h +++ b/JEUX_SERPENT/fonction.h @@ -10,7 +10,6 @@ extern unsigned long int suivant; extern int serpent, tete_up, tete_down, tete_right, tete_left; extern int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400]; -extern long int vitesse; extern int segment; extern int pomme, pommex[5], pommey[5]; @@ -27,6 +26,7 @@ void Pomme(); int Controle(int direction); void Serpent(int direction); void Update_Serpent(int direction); +long int Update_Vitesse(long int vitesse); void Terrain(); void Timer(); diff --git a/JEUX_SERPENT/main.c b/JEUX_SERPENT/main.c index 401bb64..e1c93a1 100644 --- a/JEUX_SERPENT/main.c +++ b/JEUX_SERPENT/main.c @@ -61,13 +61,17 @@ int main(){ /*Boucle Principale du Programme*/ while(go_on){ direction = Controle(direction); + vitesse = Update_Vitesse(vitesse); + Controle(direction); if (pause==1){ Timer(); Score(); Collision(); + Update_Vitesse(vitesse); Serpent(direction); Pomme(); + Attendre(vitesse); } } diff --git a/JEUX_SERPENT/serpent.c b/JEUX_SERPENT/serpent.c index af194c4..9ccd1fa 100644 --- a/JEUX_SERPENT/serpent.c +++ b/JEUX_SERPENT/serpent.c @@ -49,7 +49,6 @@ int Controle(int direction){ /*Avancement automatique du serpent en fonction de la direction*/ void Serpent(int direction){ - int p=0; if (direction == 1){ pos_y[0]=old_y[0]-20; } @@ -62,7 +61,13 @@ void Serpent(int direction){ if (direction == 4){ pos_x[0]=old_x[0]+20; } + Update_Serpent(direction); + Terrain(); +} +/*augmentation de la vitesse en fonction des pommes mangées*/ +long int Update_Vitesse(long int vitesse){ + int p=0; for(p=0; p<5; p++){ if(pommex[p]==pos_x[0] && pommey[p]==pos_y[0]){ segment+=2; @@ -70,13 +75,11 @@ void Serpent(int direction){ pommey[p] = ((rand() % (34)+1)*20); if (vitesse>20000){ vitesse=vitesse-1500; - } + printf("%ld\n", vitesse); + } } } - - Update_Serpent(direction); - Terrain(); - Attendre(vitesse); + return vitesse; } /*fonction pour mettre à jour la position du serpent*/