bool = Collision(type, ...) bool = Collision(#BOX, x1, y1, width1, height1, x2, y2, width2, height2) bool = Collision(#BRUSH, id1, x1, y1, id2, x2, y2) bool = Collision(#LAYER, id1, id2) bool = Collision(#SPRITE, id1, id2) bool = Collision(#BRUSH_VS_BOX, id, x, y, x2, y2, width2, height2) (V4.5) bool = Collision(#LAYER_VS_BOX, id, x, y, width, height) (V4.5) bool = Collision(#SPRITE_VS_BOX, id, x, y, width, height) (V4.5) bool = Collision(#SPRITE_VS_BRUSH, id1, id2, x, y) (V7.1)
The following collision types are currently supported:
#BOX:
#BRUSH:
id1
and id2
would collide
if they were shown at x1
and y1
and x2
and y2
, respectively.
Transparent areas (mask or alpha channel) of the brushes will be
fully respected so that you get an exact result if pixels collide or not.
#LAYER:
id1
and id2
collide. If
the layers have transparent areas, they will be respected. If you use
this type, layers must be enabled of course.
#SPRITE:
id1
and id2
collide. If
the sprites have transparent areas, they will be respected.
#BRUSH_VS_BOX:
#LAYER_VS_BOX:
#SPRITE_VS_BOX:
#SPRITE_VS_BRUSH:
id1
collides with the brush
specified by id2
in case the brush was displayed at the position
specified by x
and y
. (V7.1)
#BOX
, #BRUSH
, #SPRITE
, #LAYER
, #BRUSH_VS_BOX
,
#LAYER_VS_BOX
, #SPRITE_VS_BOX
, or #SPRITE_VS_BRUSH
(see above)True
for collision, False
otherwiseBox(10, 10, 100, 100, #RED) Box(70, 70, 100, 100, #BLUE) b = Collision(#BOX, 10, 10, 100, 100, 70, 70, 100, 100)This returns
True
because the rectangles collide.