This entry marks the first entry of a new Devlog Series.
I’m currently working on a couple of GameMaker projects and I thought it might be useful to document my development process. I’ve been inspired to do so by reading the Loadworld Devlog PT. 2 by @ZackBellGames
I always start my projects by creating a Helpers group in my script assets.
sdm stands for Show Debug Message. This can be used as quickly as
sdm(var). You don’t even have to ensure that
var is a string. Unless you want to print a message.
///sdm(message, [only_in_debug_mode]) var only_in_debug_mode = false if argument_count == 2 only_in_debug_mode = argument if only_in_debug_mode && !global.debug exit // Eventually cast to String if (is_string(argument) == false) var message = string(argument) else var message = argument show_debug_message(message)
approach is used mostly to replace of the standard lerp function.
///approach(start, end, shift); if (argument < argument) return min(argument + argument, argument); else return max(argument - argument, argument);
iff and iif (sometimes also ift) is a ternary operator replacement. I tend to have such variety of names for a single script because I make mistakes when I type. That’s the real reason. You can name them whatever you want.
///iff(condition, branch_a, branch_b) /* This is a shorthand / replacement for a ternary operator in GML. * condition: The condition that needs to be satisfied to return branch_a. * branch_a: Returned if condition is true. * branch_b: Returned if condition is false. */ condition = argument branch_a = argument branch_b = argument if (condition) return branch_a else return branch_b
gdash – GML utility library
This is something I found around the web and I consider it to be extremely useful. It’s the gdash GML utility library.
gdash is a functional utility library for GML, inspired by lodash. It aims to add useful, broad-purposed functions to help aid in game development. If you are doing any kind of data manipulation in your game, gdash can help out.
It can be used in devious ways. There are some examples on the github page. Check it out.
Next time I’ll post my Input Management scripts. I use them to capture both key press/release and joystick (not gamepad) press/release.