Last week I was working on a very simple game to test DragonRuby Game Toolkit and learn its API.

This Ruby implementation is based on mruby and LLVM and it’s commercial software but cheap.

The game toolkit has a simple API to handle sprites with animations, sound/music, inputs, basic drawing primitives like lines or rectangles, allows for HTTP requests and other niceties. It also has a fixed resolution and 60 times a second game loop.

The engine has a game loop that calls to a #tick method where you draw, check inputs and update game logic.

The code is structured in a couple of classes, the main one is the MyGame, that contains other classes like the Player, the list of FloorFires and the Coin to collect.

When it detects a collision it plays a sound. The game is paused when the window loses focus.

For collision detection, it uses some builtin rectangle intersection primitives.

For Input handling, the keyboard, arrows/WASD are handled the same.

And that’s pretty much it. There are a lot to improve the game but I think I’ll start a new project with a better idea to start doing something funnier and more polished.

Besides the official docs, I learnt a lot from this post series, kudos to Justin!, and also the official discord is super friendly and helpful when you get stuck on something.

The start screen:

start screen


in-game animation

The source is about 360 lines and available on GitHub. The assets are free.

You can download or play it online here at (DRGTK includes a great tool to deploy to

Happy hacking!