A function takes input, performs actions, and returns output.
GameMaker syntax is: output = function(input)
.
Functions take on the perspective of the calling instnace. So variables available to the instance will also be available within the function's block of code.
When declaring a function, local variables are declared to store each of the specified arguments, or parameters.
Before each function, a block of comments is utilized to define everything realted to it. This is important becuase it makes explicit the original programmers intent.
/// @function example_function(input_1)
/// @description Perform action with defined inputs and return outp
/// @param {Real} input_1 The first input to the function
/// @return {Undefined}
GameMaker Manual - JSDoc Comments
Is a function required to have input or output?
Does the calling instance have to pass it's own x
and y
if the function needs to reference it?
Does a function need to return output?