Featuring more tricks that you probably haven't heard about, and not just for old GameMaker versions!
Continue readingTag Archives: tutorial
Variable references in GameMaker (2023 edition)
It's been 5 years since my "variable references in GameMaker" post and people are still interested in passing variables by reference, so this I'm giving the idea a little refresh with new tools that are now available.
Continue readingGameMaker: Smooth pixel-perfect camera
This is a mini-tutorial and an explanation of an approach that allows you to have fluid sub-pixel movements with pixel-perfect cameras in GameMaker!
Continue readingUsing HTML5 accelerometer and gyroscope in 2020
Click here to see for yourself.
While looking to do some experiments with device motion data in HTML5, I found that there were no existing demos that would work on iOS 14. So, having spent a few hours figuring it out, I decided to write a tutorial with an up-to-date demo.
Continue readingGameMaker: 2.3 syntax in details
With GameMaker Studio 2.3 update out for a bit now and 2.3.1 beta just released, it seems like a great time for a blog post going over the numerous syntactic additions.
This covers the syntax itself, how it works, and what you can do with it.
Also included is a list of breaking changes and how to get around them.
Continue readingGrid-based contour traversal
This is a small post about the algorithm I wrote for the recent pixel font tool to establish paths of shapes and holes on the image.
Continue readingA small guide on writing interpreters, part 2
label hello: select dialog("Hello! What would you like to do?") { option "Count to 5": for (var i = 1; i <= 5; i = i + 1) { wait(1); trace(i + "!"); } return 1; option "Nothing": jump yousure; } label yousure: select dialog("You sure?") { option "Yes": trace("Well then,"); return 0; option "No": jump hello; }
Example of supported syntax
As some might remember, earlier this year I have published a small guide on writing interpreters, which went over the process of implementing a basic interpreter capable of evaluating expressions consisting of numbers, operators, and variables.
This continuation of the guide further expands upon concept, outlining how to support calls, statements, and branching - enough for a small scripting language.
Continue readingGameMaker: Checking whether a string is a valid number
Some things are numbers, some aren't
GameMaker Studio 2.2.2 released few days ago, bringing, among improvements, "GML consistency", which changes how automatic type conversion works in corner cases.
A little less known thing, together with that it also changed how GameMaker's string-to-number conversion function (real) works, having it throw an error if your string is definitely not a number.
A slight inconvenience, given that there is not a function to check if a string is a number before attempting conversion.
But, of course, that can be fixed.
Continue readingGameMaker: getting the arguments-array
This is a small post on how to conveniently and optimally pack an arbitrary number of incoming script arguments into an array.
Continue readingGameMaker: Simplest possible instance methods
After seeing series of increasingly strange uses of "user events" in GameMaker games for object-bound actions, it came to my attention that most people are only vaguely aware of other ways of doing things, so I decided to write a small blog post on the matter.
There are many uses for these - for example, you might want to have a "take X damage" method on your enemy objects so that it can be varied depending on requirements - some enemies might just take damage, some should retaliate on being hit, some might have a fancy damage reduction formula. Being able to comfortably define/redefine methods on per-object-type basis can help a lot.
Continue reading