Enumeration Finally Added To GameMaker Studio

A recent Early Access build has introduced C-style enumeration to GameMaker Studio, an overdue feature that will be welcomed by veteran coders. Enumerations consist of named integer constants called “members” or “enumerators”.

An example is shown below.


In the example, an enumeration with a set of 7 members is declared. The constant values of the members range from 1 to 7. The enumeration can then be referenced in the manner shown.

Learn more about enumeration »

A copy of the code used in the example can be found below. You can paste this directly into GameMaker.

enum DAY { //declare enum type
var example = DAY.thu;

show_message(string(example)); //output: 5

6 Replies to “Enumeration Finally Added To GameMaker Studio”

    • This will work:

      enum TEST {
      foo = 1,
      bar = 2,
      john = foo + bar,
      dooh = john +5

      Colo notattion is not working, also you can’t assign string values to enum list.

  • I saw this the same day it was announced, and although it can be achieved by other means, it’s simpler to create this type of data structures this way :D.

  • Seems rather useful, but it could be similarly accomplished by using constants. Still, I suppose for local scripts, it would be useful for increasing readability.

    • how can you accomplish this without using “enum” my version of game maker doesn’t seem to have it and i can’t update it

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.