instance_deactivate_object

Deactivates all instances of a given object in the room, or a particular instance if you provide an id.

Syntax:

instance_deactivate_object(obj);


Argument Description
obj The object or instance to deactivate (the keyword all can also be used).


Returns: N/A


Description

With this function you can deactivate a single instance or all instances of a specific object from all those that have been activated previously.

NOTE: If you deactivate an instance on room start (ie:from the room creation code, or from an instance create event of an instance within the room) all instances that are placed within the room from the room editor will still run their create event before being deactivated.

WARNING: Deactivating instances that have physics enabled will NOT stop their fixtures from interacting within the physics simulation. For that you should set their phy_active variable to true or false as you activate/deactivate the instances.


Example:

instance_deactivate_object(obj_Enemy);
instance_activate_region(view_xview[0] - 64, view_yview - 64, view_wview[0] + 128, view_hview + 128, false);

The above code deactivates all instances of the object "obj_Enemy" and then activates a region within the room.


Back: Deactivating Instances
Next: instance_deactivate_region
© Copyright YoYo Games Ltd. 2018 All Rights Reserved