Collision events (the ones from the event selector, NOT collision checks in the Step event): other refers to the colliding instance
in this event only. IMPORTANT NOTE:
other is always equal to -2 and will lose context outside the event. If you need the actual instance ID later, you need to use
other.id instead.
GML:
last_collided_enemy = other.id;
Collision-checking functions: instance_place() and
instance_position() are the instance-ID-oriented analogues of
place_meeting() and
position_meeting(). Functions that start with
collision_ but don't end in
_list all return instance IDs. Save that instance ID into a variable, then use that as the subject to work with.
Note that these functions return noone upon not finding a collision. Always account for this special case whenever you handle collisions this way.
GML:
var inst_enemy = instance_place(x, y, obj_enemy);
if (inst_enemy != noone) {
inst_enemy.hp -= 10;
}