instance_number(obj)

obj = The object you want to find how many of there is.

 

Example

if instance_number(obj_gems) = 0

{

// There are no more gem objects left in the playing area;

}

 

This function can be used to check if there are any instances of an object left in the room. This is particularly useful if you have a number of instance of an enemy and you want the player to move to the next level after he's destroyed all the enemy.  You can also use multiple check for different objects:

 

if (instance_number(obj_enemy01) = 0) && (instance_number(obj_enemy02) = 0)

{

// Goto the next level / room;

}

 

Revision #2