2
\$\begingroup\$

Let's say, I have three objects: obj_square, obj_circle and obj_triangle.

Instances of all three types of objects exists in the room and call the same script: scr_test.

Inside of this script, how can I check instance of which object is calling it?

Pseudocode:

if(self is instanceof(obj_circle))
{
// do stuff
}
\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

object_index

This read only variable returns the index of the object that the instance has been created from.

So your code would read:

if(object_index == obj_square) {
    // ...
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .