From 57319c29b4b1671351714a09af9c21d1f1fbc3bf Mon Sep 17 00:00:00 2001 From: beaur Date: Tue, 21 Nov 2023 17:03:42 +0100 Subject: [PATCH] direction --- Direction.c | 63 ++++++++++++++++------------------------------------ exec | Bin 16000 -> 16000 bytes 2 files changed, 19 insertions(+), 44 deletions(-) diff --git a/Direction.c b/Direction.c index bf9e2fc..d2e581a 100644 --- a/Direction.c +++ b/Direction.c @@ -71,26 +71,8 @@ int main(void){ suivant=Microsecondes()+DELTA; } /*deplacements du serpent*/ - if(bas==1){ - if(Microsecondes()>suivant2){ - sxmax=sxmax+1; - tab[sxmax][symax]=1; - tab[sxmin][symin]=0; - sxmin=sxmin+1; - suivant2=Microsecondes()+DELTA; - } - } - - else if(haut==1){ - if(Microsecondes()>suivant2){ - sxmax=sxmax-1; - tab[sxmax][symax]=1; - tab[sxmin][symin]=0; - sxmin=sxmin-1; - suivant2=Microsecondes()+DELTA; - } - } - else if(gauche==1){ + + if(ToucheEnAttente()&&Touche()==XK_Left){ if(Microsecondes()>suivant2){ symax=symax-1; tab[sxmax][symax]=1; @@ -98,8 +80,8 @@ int main(void){ symin=symin-1; suivant2=Microsecondes()+DELTA; } - } - else if(droite==1){ + } + if(ToucheEnAttente()&&Touche()==XK_Right){ if(Microsecondes()>suivant2){ symax=symax+1; tab[sxmax][symax]=1; @@ -107,32 +89,24 @@ int main(void){ symin=symin+1; suivant2=Microsecondes()+DELTA; } - } - - - if(ToucheEnAttente()&&Touche()==XK_Left){ - haut=0; - bas=0; - droite=0; - gauche=1; - } - if(ToucheEnAttente()&&Touche()==XK_Right){ - haut=0; - bas=0; - droite=1; - gauche=0; } if(ToucheEnAttente()&&Touche()==XK_Up){ - haut=1; - bas=0; - droite=0; - gauche=0; + if(Microsecondes()>suivant2){ + sxmax=sxmax-1; + tab[sxmax][symax]=1; + tab[sxmin][symin]=0; + sxmin=sxmin-1; + suivant2=Microsecondes()+DELTA; + } } if(ToucheEnAttente()&&Touche()==XK_Down){ - haut=0; - bas=1; - droite=0; - gauche=0; + if(Microsecondes()>suivant2){ + sxmax=sxmax+1; + tab[sxmax][symax]=1; + tab[sxmin][symin]=0; + sxmin=sxmin+1; + suivant2=Microsecondes()+DELTA; + } } /*affichage du tableau pour rendu graphique*/ @@ -151,3 +125,4 @@ int main(void){ } + diff --git a/exec b/exec index 1e0a3a0ca68753d3ca80b80e92dde31767424e5f..93f9019b72b474a3073925cff70f542b19b43740 100755 GIT binary patch delta 1108 zcmZpuZK&PA!N`@$$p8kaoSTIh%a}w2ZY8_2ubdR~cWyvU`n|Mu{a?RCZ=S>KBarHG z>;Hd{(&Mc@a8>}E6#{4Jz*z=xmI<6?0cY6&S&U%w9Dpn?Fw14KuZX#l3RKPOz~ikN zFt%wonC+2#qPtaPvcI^T0mw1UU_r*_y&!egb%&Z;L7IVl5T#zXth*It4Oo)}NRt3a zQ+KNiOwa)+sKkF9tP3RdS{Gz`u&62r%$&&$qS727_cM04noM3Ssu;8br0~U|U;qEN z9^h|T2joCR4gf_wYy*LT#NRptE_w?jYT23qG=aal5h&ce7GyinG!#duaG^T19;gzi z6dXtp<0C-^u{t>MGkA1@je`g?0fkZB!2nWd8;s@-DUc|NJHQS=amOv7lH>~>ofkX~ zPL2|n#Ofq)fHFetp7|52lbnFUs7`VKDYOkjb5ayY6vatvK}msRC#?k~DyWlg{=n*_ zCZI5?lNvw@Z9~wUGz%n(;-prxoYacsBuR89Atkp|q!ez^4Nk?~y`ZGmJr$IDy0?OI zlSglB0g!U+{Nd4g{KaLUam}qDaS^oCzyCN;*bI_On_EHpfhu6>7|2tvn*>q;%f_(m z`BMMS|Non%rJk}*{=ji$lL8AP(`DApY>G_0Oc9csx%BoigXmL+VoV_MN5=cun94aO VFS63(ijV}QQU(T~^ewAp%mBeJ_SXOa delta 1184 zcmZpuZK&PA!N{e_#Q+AHT$_a$%a}yAskbgRiOLpS8(GZ%{(wo`-xZthZl1&JBfzb4 z>;Hd{(&Mcfli5XNZEfIu2RO?G&hmh>e1I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