Hi
thank you for your comments.
I have tried this technic and it works fine :
Function CheckWall(i)
For j =0 to Other.Building.length
if i <> j
if Other.Building[j].Id =BUILDING_DEFENSE
if Other.Building[j].y =Other.Building[i].y-23
if (Other.Building[j].X =Other.Building[i].X-32)
if result = 0
Result = 1
else
result = 3
endif
endif
if (Other.Building[j].X =Other.Building[i].X+32)
if result = 0
Result = 2
else
Result = 3
endif
Endif
Endif
Endif
Endif
next
Endfunction result
In the main code, i use (after a mousereleased) :
// si c'est un wall, on doit vérifier s'il touche d'autre wall pour changer son aspect
For i=0 to Other.Building.length
if Other.Building[i].id =BUILDING_DEFENSE
n = Other.Building[i].Sprite
result = CheckWall(i)
SetSpriteFlip(n,0,0)
select result
case 1
SetSpriteFrame(n,3+Other.Building[i].Level-1)
SetSpriteFlip(n,1,0)
endcase
case 2
SetSpriteFrame(n,3+Other.Building[i].Level-1)
endcase
case 3
SetSpriteFrame(n,5+Other.Building[i].Level-1)
endcase
case 0
SetSpriteFrame(n,1+Other.Building[i].Level-1)
endcase
endselect
endif
next
And the result in my test :
AGK2 tier1 - http://www.dracaena-studio.com