Skip to content

Instantly share code, notes, and snippets.

@thennothinghappened
thennothinghappened / EventEmitter.gml
Last active February 15, 2025 00:49
Basic EventEmitter for GameMaker
#macro EVENT_EMITTER_DEBUG_ASSERTIONS true
/**
* @param {String} ... Names of the events emitted by this emitter.
*/
function EventEmitter() constructor {
self.listeners = {};
self.oneTimeListeners = {};
@thennothinghappened
thennothinghappened / FSM.gml
Last active February 15, 2025 00:50
Basic finite state machine in GameMaker Language.
/**
* @param {String} initialStateName Name of the state to execute first.
*/
function FSM(initialStateName) constructor {
/**
* @ignore
*/
self.states = {};
@thennothinghappened
thennothinghappened / Err.gml
Last active February 13, 2025 04:58
GameMaker somewhat useful error struct
/**
* Generic Error type as analogue of GM's `Struct.Exception`.
*
* @param {String} msg The readable message for this error.
* @param {Struct.Err|Struct.Exception|Undefined} [cause] The error which caused this one, if any.
* @param {Array<String>|Undefined} [__stacktrace] The stacktrace of this error,
*/
function Err(msg, cause = undefined, __stacktrace = undefined) constructor {
@thennothinghappened
thennothinghappened / Gamemaker Theme.md
Last active December 19, 2024 00:17
my GameMaker IDE theme

What is this?

This gist just includes my GameMaker IDE Code Editor theme. The theme was originally just throwing together some colours, but I thought it looked kinda alright! Storing this here firstly so I don't lose it, but if you like it for whatever reason, read below to set it up!

Installing it!

Code Editor 1