This action is used to check and see if there is a collision with an instance of a given object within a given shaped area or along a line. You give the shape (rectangle, ellipse or line), the object to check for, and then supply the coordinates for the upper-left and lower-right corners of the shape being used, or in the case of a line, the start and end positions. These can be absolute positions within the game room, or positions relative to the instance performing the action. You can see how this works in the image below:
As you can see, the results will depend on the collision mask of the instance being checked for, meaning the instance of the object you are looking for must have a sprite assigned to the sprite_index, or a sprite assigned to the mask_index. If it does not then it will not be detected by these functions, regardless of whether it is drawing a sprite or not. It is worth noting that any instance that falls completely within the boundaries set for the ellipse or rectangle shape will also return a collision.
The action will return the keyword noone if no collision is returned, or it will return the uniq ID value of the instance that is found to be in collision. You can also check the "Not" flag to check if there is not a collision at the given position. Note that if multiple instances are found to be in collision you will get returned a single ID value which could correspond to any of the instances (but only one of them). You can flag the target variable as a temporary (local) variable, which means that the action will create this variable to hold the return value until the end of the event.
Note that to add actions into an "if" block, they should be dropped to the side of the action, as shown in the image below:
Argument Description Shape The shape to use Object The object to check for instances of x1 The x position to start from y1 The y position to start from x2 The x position to end at y2 The y position to end at Target The variable to target for the return value of the action
The above action block code checks for a collision with any instances of the object "obj_Player_Parent" along a 200px across the calling instance. The return value of the action is stored in a temporary (local) variable and then a check is done to see if the returned value is an instance that exists in the room. If it is, the instance has a value removed from an instance variable.