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

17. AI

Ben Tyers1  
(1)
Worthing, West Sussex, UK
 

Most games will have an enemy that exhibits some basic AI (Artificial Intelligence). This chapter serves as an introduction to some basic AI.

Some of the functions the AI may have:
  • Avoid the player

  • Guard an area and attack the player if they get too close

  • Calculate the best play in a card game

  • Shoot a projectile at the player

  • Shoot at a player if they see them

Generally, you will evaluate some code and determine if it is true or false (or some other value) and make something happen as a result.

This section will start with a basic system and ...

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.