© 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_11

11. Collisions

Ben Tyers1  
Worthing, West Sussex, UK

Collisions are when two instances collide (actually their mask or bounding box). When these collisions happen, you can execute code.

Here are some examples of things you want to happen when a Collision Event takes place:
  • Destroy an object, for example a projectile

  • Draw a graphical effect, like an explosion

  • Play a sound effect

  • Change the value of the score, health, or lives – either up or down

  • Set instance to move or stop moving

  • Create a new instance of an object

  • Execute a script

  • Go to a different room

  • Make the object follow a path

  • Start ...

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.