© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
B. TyersGameMaker Fundamentalshttps://doi.org/10.1007/978-1-4842-8713-2_2

2. Conditionals

Ben Tyers1  
(1)
Worthing, West Sussex, UK
 

Conditional statements are used to compare or evaluate expressions and perform actions based on whether they evaluate as true or false.

You will use conditionals a lot in your game to make things happen (or not happen). For example:
  • Making an instance change direction upon collision with another instance

  • Basic AI for enemies such as shooting a projectile or moving

  • Play a sound effect in response to something happening

  • A level unlock system based on the player's score or when they collect

  • something

  • Fire a projectile or move in response ...

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.