如果有实例位于


描述

This action is used to check and see if there is an instance of any object placed at a position based on the collision mask of the calling instance. You give the position, which can be an absolute position or a position relative to the instance, and the action will return true if there is a collision or false if there is not. You can also check the "Not" flag to check if there is not a collision at the given position, and the action will then return true if no collisions are found and false otherwise. 碰撞的计算原理是:被调用的实例的碰撞遮罩,是否与其它实例的碰撞遮罩在某一个位置有重叠。

重要! 碰撞检测只对那些有碰撞遮罩的实例有效 (碰撞双方都要有)。例子:它们有一个被分配给sprite_index的精灵, 或被分配给 mask_index的精灵。If either of the instances in the collision have no collision mask then the collision will not be detected, regardless of what the instance is drawing at the time.

注意如果需要添加此动作进”if"代码块,它们应该被放到动作的 一边 ,如下图所示: If Drop 的例子


动作语法:

If Any Object At Place Syntax


参数:

参数 描述
x 需要检查的X坐标
y 需要检查的X坐标


例如:

If Any Object At Example
The above action block code checks for a collision at the position where the instance is placed and if one is found it blends the instance with red, otherwise it leaves the blending as normal (white).