phy_active

Enables (or disables) an instance in the physics world.

Syntax:

GML Code Example

phy_active;


Returns: Boolean


Description

This variable controls whether or not the instance is currently "active". Setting it to false will prevent the instance from participating in the physics world, and setting it to true will have it participating again. Please note that this is not the same as deactivating the instance, as the instance is still visible on the screen and can still be changed through code, rather this function just prevents it from participating in the physics simulation.


Example:

GML Code Example

if keyboard_check_pressed(ord"P")
    {
    global.Pause = !global.Pause
    with (obj_Parent)
       {
       phy_active = !global.Pause;
       }
    }
 

The above code will detect a keypress of the letter "P" and then toggle the global variable "Pause" from true to false and back again. This variable is then used to set whether physics is active or not in the children instances of the object indexed in the variable "obj_Parent".





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here