Is there some way to avoid detecting the spritehit when one sprite is behind another? Should I create an array of objects and iterate to check if they are in the front or not?
Here's an example:
lb=createsprite(0)
SetSpriteSize(lb,600,600)
SetSpritePosition(lb,100,100)
SetSpriteDepth(lb,0)
spt=createsprite(0)
SetSpriteSize(spt,90,60)
SetSpritePosition(spt,66,150)
SetSpriteColor(spt,255,0,0,255)
do
if GetPointerPressed()
if GetSpriteHitTest(spt,getpointerx(),getpointery())
print("pressed")
endif
endif
sync()
loop
I want to avoid the sprite hit detection of the "spt" sprite since its behind another sprite.