Skip to content
Snippets Groups Projects
Commit 782d4001 authored by Montjoie Henri's avatar Montjoie Henri
Browse files

[RE-CHAMPAGNE] le deplacement marche

parent 49eb0145
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -675,7 +675,7 @@ int affichage_carte() ...@@ -675,7 +675,7 @@ int affichage_carte()
{ {
int i,j,y=0; int i,j,y=0;
int x=0; int x=0;
int perso_actuel=1; int perso_actuel=4;
SDL_Event event; SDL_Event event;
SDL_Surface* ecran=SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE)+LARGEUR_BORDURE, HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF);; SDL_Surface* ecran=SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE)+LARGEUR_BORDURE, HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF);;
SDL_Surface* cases[HAUTEUR_CARTE][LARGEUR_CARTE]; SDL_Surface* cases[HAUTEUR_CARTE][LARGEUR_CARTE];
......
...@@ -19,11 +19,16 @@ ...@@ -19,11 +19,16 @@
*/ */
boolean case_a_cote(Personnage * perso, Case * destination){ boolean case_a_cote(Personnage * perso, Case * destination){
Case *depart = getPosition(perso); Case *depart = getPosition(perso);
int i;
printf("depart: %d, %d, arrivee: %d, %d",get_x(depart),get_y(depart),get_x(destination),get_y(destination));
if (get_x(depart)>get_x(destination)+1||get_x(depart)<get_x(destination)-1||get_y(depart)>get_y(destination)+1||get_y(depart)<get_y(destination)-1){ if (get_x(depart)>get_x(destination)+1||get_x(depart)<get_x(destination)-1||get_y(depart)>get_y(destination)+1||get_y(depart)<get_y(destination)-1){
return faux; return faux;
} }
if (get_y(depart)==get_y(destination)+1&&get_x(depart)!=get_x(destination)){ for(i=0;i<LARG_MAX_CARTE;i+=2){
return faux; if (get_y(depart)==get_y(destination)+1&&get_x(depart)!=get_x(destination)&&get_x(depart)==i+1)
return faux;
if (get_y(depart)==get_y(destination)-1&&get_x(depart)!=get_x(destination)&&get_x(depart)==i)
return faux;
} }
return vrai; return vrai;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment