From 6888ce3d532d11cb199bf651a69d2482e015e5cc Mon Sep 17 00:00:00 2001 From: beaur Date: Fri, 8 Dec 2023 09:13:33 +0100 Subject: [PATCH] obstable --- Direction.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Suivre.c | 2 + exec | Bin 16168 -> 16096 bytes 3 files changed, 173 insertions(+) create mode 100644 Direction.c diff --git a/Direction.c b/Direction.c new file mode 100644 index 0000000..89cad34 --- /dev/null +++ b/Direction.c @@ -0,0 +1,171 @@ +#include +#include +#include +#include + +#define H 40 +#define L 60 +#define DELTA 1000000L +#define DELTO 1000L + +void AfficheTab(int tab[H][L], int posx, int posy, int i, int j){ + couleur c; + if(tab[i][j]==0){ + c=CouleurParNom("green"); + ChoisirCouleurDessin(c); + RemplirRectangle(posx,posy,20,20); + } + + if(tab[i][j]==1||tab[i][j]==6||tab[i][j]==7||tab[i][j]==8||tab[i][j]==9){ + c=CouleurParNom("yellow"); + ChoisirCouleurDessin(c); + RemplirRectangle(posx,posy,20,20); + } +} + +void Affiche(int tab[H][L]){ + /*affichage du tableau pour rendu graphique*/ + int i,j,posx=0,posy=0; + for(i=0;isuivant){ + n++; + DessinerTimer(n); + suivant=Microsecondes()+DELTA; + } + + + /*deplacement tete*/ + if(Microsecondes()>suivant2){ + /*haut*/ + if(direction==2){ + sxmax=sxmax-1; + tab[sxmax][symax]=1; + } + /*droite*/ + if(direction==3){ + symax=symax+1; + tab[sxmax][symax]=1; + } + /*gauche*/ + if(direction==1){ + symax=symax-1; + tab[sxmax][symax]=1; + } + /*bas*/ + if(direction==0){ + sxmax=sxmax+1; + tab[sxmax][symax]=1; + } + suivant2=Microsecondes()+DELTO; + } + + if(fin==1){ + return EXIT_SUCCESS; + } + + } + + + +} + diff --git a/Suivre.c b/Suivre.c index a842b46..3e70ddb 100644 --- a/Suivre.c +++ b/Suivre.c @@ -110,6 +110,7 @@ int DepYTete(unsigned long suivant2,int sxmax,int symax,int direction,int tab[H] /*mvmt du serpent*/ + void Serpent(int tab[H][L]){ int sxmax=10,sxmin=1,symin=1,symax=1,direction=0; unsigned long suivant2=Microsecondes()+DELTO; @@ -127,6 +128,7 @@ void Serpent(int tab[H][L]){ } + /*affichage du timer*/ void DessinerTimer(int n){ couleur c; diff --git a/exec b/exec index 351395b3a197b388a8efa1802d1cc20bd99651a8..da0caab3e79870ddc9d627083defc7decc3fc200 100755 GIT binary patch delta 2497 zcmbVOdrXs86uF z5y3lMT=oZl%(yLK8FtBlA>xcFEY7g~v8Y*G7iU(Zi#mLO)_ptYeqZsi{ju#P-#PdE z?m6e4bMEQA{iHq6)|F1TbT2xp3q}$?g5Bpcqk0vgH1J7e zl2^+xsb+_T>+wUkr9;}+Q$x<~=;r9p_xv#N^M`xbN2(gy$_#2F{SGNBQzz1ceAc2) zWRt2y)&pD*U%%R-nF5EYtWSuepK+TXIql%|H%|N5R!w_Mb+e zIjf;WAe8k*%*#!H@byY)Uv?jgAVf{f3KrkcFq04!S)#~}*$p}Zmbpx)eSxZ&O?#B8 zeKR93X%Fb{3+pt#2l~Y{-TJ2_i5}~u=!MVY52EaK1iaQ?2jXF)K_mcQWb0#pPq#dH zTp8tmP#$A-aUN$s#u@xH1STcb5+U|NnYT8ICC{Qdk$t;W50VX%rFwad&4wV zqv*-8o9;nO8VKGAA-d~fO~wU|m#vIJcniQ{r@I9i+g zNAQISinXI&p0ijxE_%krlL5832$>+#QU5-k02W5JR)Mu#7qoW%S96M+^RoV* z%?WP)Xz1JjW$bc6woPK4u;-Lha~;QXr7`Ypa5!8?^lrlLjSqKk9GHxqBEB-yNCXQ+ z_8c&)o!fWXY)xdht+BDWm9*A3*lpzH#;vul5_`jIHglml4Sp~*NmYcmE!ghk=M~N!sPwC$gR?UnMywO^C zKIQ;41Yhn1yO1(F;wPA1nqc=*W*6agGyt*SB{^-io*QwiIS@-PtXJVh7WS&D6hOn5 zmAZch)aea2vMkXMsRXSslEAJkOBQ+(SyVw01$EoEG7ntY}BaVY7WRaPD-_^Mela7V#U zGn!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