Functions

Game Maker 8

Functions

A function has the form of a function name, followed by zero or more arguments between brackets, separated by commas.

<function>(<arg1>,<arg2>,...)

There are two types of functions. First of all, there is a huge collection of built-in functions, to control all aspects of your game. Secondly, any script you define in your game can be used as a function.

Note that for a function without arguments you still need to use the brackets. Some functions return values and can be used in expressions. Others simply execute commands.

Note that it is impossible to use a function as the lefthand side of an assignment. For example, you cannot write instance_nearest(x,y,obj).speed = 0. Instead you must write (instance_nearest(x,y,obj)).speed = 0.