Event: In(target1, target2)

Related Events: out, stillin, stillout
Related Actions: letinside
See also: FKiSS, Events, Actions

in(target1, target2)

First defined in: FKiSS2
The in event makes a comparison based on the individual bounding rectangles of the two targets. If a bounding rectangle for target1 overlaps a bounding rectangle for target2 and no rectangles previously overlapped, this event will occur. When the targets are objects or groups, comparison is made using the individual bounding rectangles of the applicable cels, not the single bounding rectangle for the entire object. In other words, if any one cel of the target1 object or group overlaps any one cel of the target2 object or group, the in event is triggered.
This event may be triggered by the user picking up an object and dropping it somewhere else or by FKiSS movement.
Use this event to react to collision-detection when pixel-collision detection is not necessary. A common use for the in event is snap-to (where a cel dropped anywhere onto another cel should be moved to an exact position).
Only one in event should exist for any target1-target2 pair.

target1

In FKiSS2 to FKiSS3, target1 must be an object number.
In FKiSS4, target1 may be an object number, cel, or group.

target2

In FKiSS2 to FKiSS3, target2 must be an object number.
In FKiSS4, target2 may be an object number, cel, or group.

Example:

; Note: The behavior demonstrated here is a form of snap-to.
;
;@ in(#1, #2)           ; When any cel in object #1 overlaps any cel in object #2...
;@  movebyx(#2, #1, 5)  ; Move object #2 to 5 pixels right of object #1's position.
;@  movebyy(#2, #1, 12) ; and move object #2 to 12 pixels down from object #1's position.