Using functions for code that is used often within your game is great way to make it easier to read and quicker to update. Additionally, it makes it easier to organize and understand how your code works. A GML function is also useful in processing data, especially if you will be doing the same calculation again and again. This can include sending data to the script, processing it, and returning an outcome or variable. If you are using the same code twice or more anywhere in your program, then you should consider using a function. ...
24. Functions
Get GameMaker Fundamentals: Learn GML Programming to Start Making Amazing Games now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.