18Fermer20
GodzilLe 19/04/2017 à 15:38
Pour le fun:

function get_pattern(mp,x,y) local cur=get_tile(mp,x,y) local ret=0 if ((x>1) and (get_tile(mp,x-1,y)~=cur)) ret = bor(ret,8) if ((x<16) and (get_tile(mp,x+1,y)~=cur)) ret = bor(ret,2) if ((y>1) and (get_tile(mp,x,y-1)~=cur)) ret = bor(ret,1) if ((y<16) and (get_tile(mp,x,y+1)~=cur)) ret = bor(ret,4) if ret==0 then if ((x>1) and (y>0) and get_tile(mp,x-1,y-1)~=cur) ret = bor(ret,24) if ((x<16) and (y>0) and get_tile(mp,x+1,y-1)~=cur) ret = bor(ret,17) if ((x<16) and (y<16) and get_tile(mp,x+1,y+1)~=cur) ret = bor(ret,18) if ((x>1) and (y<16) and get_tile(mp,x-1,y+1)~=cur) ret = bor(ret,20) end return ret end