Slt, voila mon probléme :
Sur la map j'ai besoin de rendre inaccésible certaine cases !
Donc sa pas de probléme, mais le code est trés lourd et long à faire ! ex:
Sur la map j'ai besoin de rendre inaccésible certaine cases !
Donc sa pas de probléme, mais le code est trés lourd et long à faire ! ex:
Code PHP :
<?php
if($_SESSION[X_joueur]==$x AND $_SESSION[Y_joueur]==$y)
echo '<td style="background-image:url('.$texture[$carte[$x][$y]].');width:32px;height:32px;text-align:center;">
<img width="16" src="../img/avatar.gif" /></td>';
elseif( // 1ere ligne horizontal.
$x==20 AND $y==0 or $x==20 AND $y==1 or $x==20 AND $y==2 or $x==20 AND $y==3 or
$x==20 AND $y==4 or $x==20 AND $y==5 or $x==20 AND $y==6 or $x==20 AND $y==7 or
$x==20 AND $y==8 or $x==20 AND $y==9 or $x==20 AND $y==10 or $x==20 AND $y==11 or
$x==20 AND $y==12 or $x==20 AND $y==13 or $x==20 AND $y==14 or
$x==20 AND $y==15 or $x==20 AND $y==16 or $x==20 AND $y==17 or $x==20 AND $y==18 or $x==20 AND $y==19 or
// 1ere ligne horizontal.
$x==-1 AND $y==0 or $x==-1 AND $y==1 or $x==-1 AND $y==2 or $x==-1 AND $y==3 or
$x==-1 AND $y==4 or $x==-1 AND $y==5 or $x==-1 AND $y==6 or $x==-1 AND $y==7 or
$x==-1 AND $y==8 or $x==-1 AND $y==9 or $x==-1 AND $y==10 or $x==-1 AND $y==11 or
$x==-1 AND $y==12 or $x==-1 AND $y==13 or $x==-1 AND $y==14 or $x==-1 AND $y==15 or
$x==-1 AND $y==16 or $x==-1 AND $y==17 or $x==-1 AND $y==18 or $x==-1 AND $y==19 or
// 1ere ligne horizontal.
$x==-1 AND $y==20 or $x==0 AND $y==20 or $x==1 AND $y==20 or $x==2 AND $y==20 or
$x==3 AND $y==20 or $x==4 AND $y==20 or $x==5 AND $y==20 or $x==6 AND $y==20 or
$x==7 AND $y==20 or $x==8 AND $y==20 or $x==9 AND $y==20 or $x==10 AND $y==20 or
$x==11 AND $y==20 or $x==12 AND $y==20 or $x==13 AND $y==20 or $x==14 AND $y==20 or
$x==15 AND $y==20 or $x==16 AND $y==20 or $x==17 AND $y==20 or $x==18 AND $y==20 or $x==19 AND $y==20 or $x==20 AND $y==20 or
// 1ere ligne horizontal.
$x==-1 AND $y==-1 or $x==0 AND $y==-1 or $x==1 AND $y==-1 or $x==2 AND $y==-1 or
$x==3 AND $y==-1 or $x==4 AND $y==-1 or $x==5 AND $y==-1 or $x==6 AND $y==-1 or
$x==7 AND $y==-1 or $x==8 AND $y==-1 or $x==9 AND $y==-1 or $x==10 AND $y==-1 or
$x==11 AND $y==-1 or $x==12 AND $y==-1 or $x==13 AND $y==-1 or $x==14 AND $y==-1 or
$x==15 AND $y==-1 or $x==16 AND $y==-1 or $x==17 AND $y==-1 or $x==18 AND $y==-1 or $x==19 AND $y==-1 or $x==20 AND $y==-1 or
// 1ere ligne horizontal.
$x==0 AND $y==0 or $x==0 AND $y==1 or $x==0 AND $y==2 or $x==0 AND $y==3 or
$x==0 AND $y==4 or $x==0 AND $y==5 or $x==0 AND $y==6 or $x==0 AND $y==7 or
$x==0 AND $y==8 or $x==0 AND $y==9 or $x==0 AND $y==10 or $x==0 AND $y==11 or
$x==0 AND $y==15 or $x==0 AND $y==16 or $x==0 AND $y==17 or $x==0 AND $y==18 or $x==0 AND $y==19 or
// 2eme ligne horizontal.
$x==1 AND $y==0 or $x==1 AND $y==1 or $x==1 AND $y==2 or $x==1 AND $y==3 or
$x==1 AND $y==4 or $x==1 AND $y==5 or $x==1 AND $y==6 or $x==1 AND $y==7 or
$x==1 AND $y==8 or $x==1 AND $y==9 or $x==1 AND $y==10 or $x==1 AND $y==11 or $x==1 AND $y==12 or
$x==1 AND $y==15 or $x==1 AND $y==16 or $x==1 AND $y==17 or $x==1 AND $y==18 or $x==1 AND $y==19 or
// 3eme ligne horizontal.
$x==2 AND $y==0 or $x==2 AND $y==1 or $x==2 AND $y==2 or $x==2 AND $y==3 or
$x==2 AND $y==4 or $x==2 AND $y==5 or $x==2 AND $y==6 or $x==2 AND $y==7 or $x==2 AND $y==8 or
$x==2 AND $y==15 or $x==2 AND $y==16 or $x==2 AND $y==17 or $x==2 AND $y==18 or $x==2 AND $y==19 or
// 4eme ligne horizontal.
$x==3 AND $y==0 or $x==3 AND $y==1 or $x==3 AND $y==2 or $x==3 AND $y==3 or $x==3 AND $y==4 or
$x==3 AND $y==16 or $x==3 AND $y==17 or $x==3 AND $y==18 or $x==3 AND $y==19 or
// 5eme ligne horizontal.
$x==4 AND $y==0 or $x==4 AND $y==1 or $x==4 AND $y==2 or
$x==4 AND $y==16 or $x==4 AND $y==17 or $x==4 AND $y==18 or $x==4 AND $y==19 or
// 6eme ligne horizontal.
$x==5 AND $y==1 or $x==5 AND $y==17 or $x==5 AND $y==18 or
// 6eme ligne horizontal.
$x==6 AND $y==1 or $x==6 AND $y==18 or
// 10eme ligne horizontal.
$x==9 AND $y==18 or
// 13eme ligne horizontal.
$x==12 AND $y==18 or
// 14eme ligne horizontal.
$x==13 AND $y==18 or
// 15eme ligne horizontal.
$x==14 AND $y==18 or
// 16eme ligne horizontal.
$x==15 AND $y==1 or $x==15 AND $y==17 or $x==15 AND $y==18 or
// 17eme ligne horizontal.
$x==16 AND $y==1 or $x==16 AND $y==2 or $x==16 AND $y==3 or
$x==16 AND $y==16 or $x==16 AND $y==17 or $x==16 AND $y==18 or
// 18eme ligne horizontal.
$x==17 AND $y==1 or $x==17 AND $y==2 or $x==17 AND $y==3 or $x==17 AND $y==4 or
$x==17 AND $y==16 or $x==17 AND $y==17 or $x==17 AND $y==18 or
// 19eme ligne horizontal.
$x==18 AND $y==1 or $x==18 AND $y==2 or $x==18 AND $y==3 or $x==18 AND $y==4 or $x==18 AND $y==5 or
$x==18 AND $y==13 or $x==18 AND $y==14 or $x==18 AND $y==15 or $x==18 AND $y==16 or $x==18 AND $y==17 or $x==18 AND $y==18 or
// 19eme ligne horizontal.
$x==19 AND $y==1 or $x==19 AND $y==2 or $x==19 AND $y==3 or $x==19 AND $y==4 or $x==19 AND $y==5 or $x==19 AND $y==6 or
$x==19 AND $y==11 or $x==19 AND $y==12 or
$x==19 AND $y==13 or $x==19 AND $y==14 or $x==19 AND $y==15 or $x==19 AND $y==16 or $x==19 AND $y==17 or $x==19 AND $y==18 or
// 1ere ligne vertical.
$x==5 AND $y==0 or $x==6 AND $y==0 or $x==7 AND $y==0 or $x==8 AND $y==0 or $x==9 AND $y==0 or
$x==10 AND $y==0 or $x==11 AND $y==0 or $x==12 AND $y==0 or $x==13 AND $y==0 or $x==14 AND $y==0 or
$x==15 AND $y==0 or $x==16 AND $y==0 or $x==17 AND $y==0 or $x==18 AND $y==0 or $x==19 AND $y==0 or
// 19eme ligne vertical.
$x==5 AND $y==19 or $x==6 AND $y==19 or $x==7 AND $y==19 or $x==8 AND $y==19 or $x==9 AND $y==19 or
$x==10 AND $y==19 or $x==11 AND $y==19 or $x==12 AND $y==19 or $x==13 AND $y==19 or $x==14 AND $y==19 or
$x==15 AND $y==19 or $x==16 AND $y==19 or $x==17 AND $y==19 or $x==18 AND $y==19 or $x==19 AND $y==19 )
echo '<td style="cursor:no-drop;background-image:url('.$texture[$carte[$x][$y]].');width:32px;height:32px;"></td>';
Voyez, je n'est pas trouvé de solution pour le réduire, j'ai penser au boucle mais pour la mise en place, sa n'a pas été concluant !
Si qq as une solution, c'est avec plaisir !