GameMaker Studio 2 (2.3)
Icon

WalrusTimer

Mors

You must be logged in to obtain assets

Description

WalrusTimer is a replacement library for GameMaker Studio 2.3+'s built-in alarms.

itch.io | GitHub | Discord Server

With this library, you can create timers that run a custom method you give it after a certain number of frames. This is very similar to GameMaker's built-in alarms, but instead of relying on separate actions, with this library, you can just use your own methods, meaning you can declare timers and what they do in a single script, or even a single line if you so choose!

The usage of this library is very similar to Javascript's "setInterval()" and "setTimeout()" methods, so if you're familiar with Javascript this will also feel very familiar.

callback1 = function() {
    show_message("Pretty cool, huh?");
}
callback2 = function() {
    show_message("This timer will repeat forever at the same interval.");
}
timer_set(callback1, 300);
timer_set(callback2, 60, true);
timer_set(function(){show_message("You can do inline functions too.");}, 200);

This library comes with 6 methods.

  • timer_set(callback, frames, repeat[OPTIONAL], arguments...[OPTIONAL])
  • timer_destroy(timer)
  • timer_get(timer)
  • timer_set_pause(timer, pause)
  • timer_get_pause(timer)
  • timer_system_update(tick_rate[OPTIONAL])
  • timer_system_room_end()

This library is only tested on Windows and HTML5 platforms, but it should also work on other platforms as well. It also comes with an example project that will teach you the basics.

The entirety of this project is licensed under MPL 2.0, so please give me credit if you end up using it.

If you have any questions, you can ask them on this project's itch.io page or at my Discord Server.

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS2.3 - Version 1.2.0. Published August 28, 2020

  • Added support for up to 16 arguments instead of 1.
  • The functions will now run in the instance the timer was created in.
  • If the instance cannot be found by the time the timer ends, the timer will get destroyed without running any code.
  • You don't have to manually declare timers as persistent anymore, it now depends on the instance running the timer.
  • Slightly updated the example.
Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait

Back to Top