Action: Letcollide(variable, target1, target2)

Related Actions: setkcf, letkcf, setfix, letfix, ghost, transparent, lettransparent, letinitx, letinity, letmapped, letobjectx, letobjecty, letwidth, letheight, letinside
Related Events: collide, apart
See also: FKiSS, Events, Actions

letcollide(variable, target1, target2)

First defined in: FKiSS3
The letcollide action makes a comparison based on the individual, non-transparent pixels of the two targets.
If any pixel for target1 overlaps a pixel for target2, variable is set to 1. Otherwise, variable is set to 0.
Since pixel-by-pixel comparison is more task-intensive, only use this action to test collision-detection when pixel-collision detection is necessary.
Use letinside first to see if the rectangles of the objects overlap then use letcollide to test the collision at a pixel level.

variable

variable must be a variable name.

target1

In FKiSS3, target1 must be a cel.
In FKiSS4, target1 may be an object number, cel, group, or variable repesenting an object number.

target2

In FKiSS3, target2 must be a cel.
In FKiSS4, target2 may be an object number, cel, group, or variable repesenting an object number.

Example:

;@ letcollide(C, "this.cel", "that.cel") ; Set C to 1 if any pixel in "this.cel" overlaps any pixel in "that.cel".
;@ letcollide(C, #5, "that.cel")         ; Set C to 1 if any pixel in "that.cel" overlaps any pixel in any cel in object #5.
;@ letcollide(C, VarObj, !MyGroup)       ; Set C to 1 if any pixel in any cel in the object identified by VarObj overlaps any pixel in any cel in group !MyGroup.