Skip to content

Instantly share code, notes, and snippets.

@FaultyFunctions
FaultyFunctions / _EventBus.gml
Last active August 1, 2023 13:24
A simple Event Bus for GameMaker Studio 2.3+
// CHANGE THIS IF YOU WANT TO CALL "global.EventBus" DIFFERENTLY
#macro Event global.EventBus
// ADD YOUR CHANNELS HERE IN BEFORE _SIZE
enum Channel {
GLOBAL,
_SIZE
}
// ADD YOUR GLOBAL EVENTS HERE
/// Mostly ported from: https://github.com/godotengine/godot/blob/master/core/math/vector2.cpp
function Vector2(x, y) constructor {
self.x = x;
self.y = y;
/// @func abs()
/// @desc Returns a new vector with all components in absolute values.
static absv = function() {
return (new Vector2(abs(x), abs(y)));
}