YoYo Games Wiki

True

From YoYoGames Wiki

In Game Maker, true is a boolean. This means that any variable assigned that value can only have 2 values, true or false.

True is most commonly used in situations where something happens if certain criteria are fulfilled. For example:

if (switch==true)
{
 instance_create(obj_trap1);
}


In Game Maker, true has a value of 1. It is a constant.

if (instance_exists(obj_player)==true)

Is the same as:

if (instance_exists(obj_player)==1)

However it is very recommended to write just:

if (instance_exists(obj_player))

because this way is the most clear.

Please note that boolean values in Game Maker are stored as real values. So even when a boolean is required you can actually provide any real value. In such a case and value <0.5 is equivalent to false and any value >= 0.5 is equivalent to true.