Skip to content

Instantly share code, notes, and snippets.

View plonp's full-sized avatar
🏠
Working from home

PLON plonp

🏠
Working from home
View GitHub Profile
@plonp
plonp / array_shuffle.gml
Created November 8, 2022 11:33 — forked from heygleeson/array_shuffle.gml
array_shuffle() for GameMaker Studio 2.3.1
// Adds to GMS2.3.1's new "array_" functions.
// Based of Fisher-Yates Shuffle https://bost.ocks.org/mike/shuffle/
function array_shuffle(_array) {
var _len = array_length(_array), _last = 0, _i = 0;
while(_len) {
_i = irandom(--_len);
_last = _array[_len];
_array[_len] = _array[_i];
_array[_i] = _last;
}
@plonp
plonp / function_execute.gml
Created December 2, 2022 22:02 — forked from tabularelf/function_execute.gml
Executing functions or methods with an array of arguments
/// @func function_execute( function/method, [arguments_in_array])
/// @desc Executes a runtime function, GML function or method, respecting method rules.
/// @param function/method
/// @param [arguments_in_array]
function function_execute(_funcMethod, _args = undefined) {
gml_pragma("forceinline");
if (is_undefined(_args)) return _funcMethod();
var _func = _funcMethod;
var _self = self;