object_is_ancestor

Returns whether an object is the parent of another.

Syntax:

object_is_ancestor(obj, par);


Argument Description
obj The object that is being checked as the child.
par The object that is being checked as the ancestor (parent).


Returns: Boolean


Description

This function can be used to check an object and see if it is an ancestor or not of another object. So, both arguments need to be object indices and not the instance ids, and the first one is always the object that you want to find out if it is a child of the second argument, which is always the object that want to check as the ancestor (parent).


Example:

if object_is_ancestor(object_index, obj_Enemy)
   {
   instance_destroy();
   }

The above code checks to see if the instance running the code is a child of the object "obj_Enemy", and if so it is destroyed.


Back: Objects
Next: object_set_mask
© Copyright YoYo Games Ltd. 2018 All Rights Reserved