The actual Structure is this:
Code: Select all
Structure Enemy
x.l
y.l
speed.l
direction.l
layer.l
EndStructure
NewList Enemy.Enemy()
And the CollisionCheck this:
Code: Select all
If SpritePixelCollision(#Sprite_Mouse,MouseX(),MouseY(),#Sprite_Enemy,Enemy()\x,Enemy()\y) And MouseButton(1)
What value should "layer" have? 1 if in back and 2 if in front of the building?
And how must i exactly do the check?
Why does this not work (but looks logically?):
Code: Select all
If
SpritePixelCollision(#Sprite_Mouse,MouseX(),MouseY(),#Sprite_Enemy,Enemy()\x,Enemy()\y)
And
SpritePixelCollision(#Sprite_Mouse,MouseX(),MouseY(),#Sprite_Building,MouseX(),MouseY())=0
And MouseButton(1)