YoYo Games Wiki

Local variable

From YoYoGames Wiki

A local variable in Game Maker is a variable that concerns the object locally only. Built-in local variables concern the object in ways like scaling of sprite, position, etc.

Regular Local Variables (Not built in)

If an object that is called o_happy has this piece of code:

{
 happy=6;
}

Then any other object could have the same variable - "happy" with another value; so each object has its own different "happy" value. For one object to access another, the object name is entered, followed by a dot, then the variable name, so that if o_sad wants to change o_happy's "happy" variable to 8, this piece of code is used:

{
 o_happy.happy=8;
}

See Also