Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Gamemaker Essentials
  • Table Of Contents Toc
Gamemaker Essentials

Gamemaker Essentials

3.8 (13)
close
close
Gamemaker Essentials

Gamemaker Essentials

3.8 (13)

Overview of this book

This book is for users experienced with game development who now want to learn how to develop games in GameMaker: Studio in a fast-paced way.
Table of Contents (11 chapters)
close
close

Statements and loops


In nearly every programming language, there is the option to use statements such as if and else. Often, we need to use loops such as the for loop. Statements and loops make a programmer's life much easier when it comes to keeping code readable and organized, so let's take a look at how these look in GML.

Loops allow developers to greatly reduce the amount of code needed to execute a repetitive task. Instead of using multiple if statements, the programmer can summarize it all into a single loop, keeping the code short and concise.

Statements

First, we will look at the simpler of the two statements. We will begin with the most commonly used statement, the if statement.

The if statement

The if statement allows us to ask our game questions and then tell it what to do depending on the answer. The answer will either be true or false, never anything else.

In GameMaker, an if statement can be structured in multiple ways. An experienced programmer will often use brackets to enclose...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Gamemaker Essentials
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon