Game Development Reference
In-Depth Information
Scripts
Scripts are one of the most useful things when programming in GameMaker. A script is ba-
sically a code block that can be accessed by any object at any time during the game.
They become extremely useful when multiple objects need to execute the same code. In-
stead of copying the code into each object, you can create a script with the code in it and
simply type the script name into the object instead of the entire code. Then, if there is an er-
ror within that script, you only need to change one piece of code instead of many
throughout each object.
Scripts can also be used to create your own functions. Using arguments, you can make a
script that allows for input when it is run by an object. You can also return a value back to
the object from a script. You can take advantage of this when performing complicated math
functions that require a value to be saved for the future. You can type the math code into a
script and then save it to a variable when it is run by returning the value.
Search WWH ::




Custom Search