Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Gamemaker Essentials

You're reading from   Gamemaker Essentials Learn all the essential skills of GameMaker: Studio and start making your own impressive games with ease

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781784396121
Length 154 pages
Edition 1st Edition
Arrow right icon
Toc

Functions


GameMaker Language is made up of functions. Functions allow for many things to be done, ranging from creating an object to drawing text to the screen. It is all done through the use of functions.

The basic structure of a function is, the function's name, an open bracket, function arguments, and a closing bracket.

function_name(arg1,arg2,arg3,ect);

An argument is a value that must be given to the functions in order for it to run correctly. As an example, let's look at drawing text to the screen.

To draw text to the screen, we will go to the draw event of an object and add a code block. In this, we will then type the function's name draw_text and a set of brackets directly after. Inside these brackets, we type our arguments.

To find out what arguments are needed, put the cursor in between the brackets and look down to the bottom of the code editor window. You will see the function name at the very bottom, and its arguments listed as shown in the following screenshot:

As you can see, we...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime