O'Reilly logo

GameMaker Essentials by Nathan Auckett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scripts

Scripts in GameMaker are blocks of code not directly related to any object in a project. A script is accessible by all objects in a project at any time and allows developers to create their own functions using GML.

Scripts allow developers to create complex calculations and have the answer returned and stored in a variable as an end result. Scripts are also commonly used when multiple objects are meant to behave the same way. Instead of typing up the same code in every object, a script can be used and run in each object.

Let's take a look at scripts and how they are used.

Creating a script

The first step to using a script is creating one. To do this, click on the icon in the main toolbar that looks a bit like a new page with a play button ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required