About This Tutorial
This tutorial illustrates how to make a small game (TankGame) with the Game Framework for RubyCocoa. The objective of this tutorial is to let you make a game that runs on MiniKidsGames or your own games based on the game framework.
Thanks to RubyCocoa, you can easily make a game compared to writing a game in Objective-C or C. However, it doesn't help you make a game in a short time because you have to know a lot of things like windows and views and controllers before you write some code.
With the power of the game framework, many things are done in the framework so you can concentrate on writing your game specific code. This tutorial explains not only how to make a game but also the mechanisms behind your game, which is done by the framework.
What you learn with this tutorial
You will learn how to make a simple game that runs on MiniKidsGames. This tutorial shows you how to make "TankGame" explaining what you should implement with the game framework including some basic things to make a game.
What you should know before reading this tutorial
As this tutorial shows how to make a game by using RubyCocoa, you should have some knowledge Ruby, in addition to a little knowledge about RubyCocoa and Cocoa frameworks behind it. This tutorial shows some information or references about RubyCocoa and Cocoa classes, but it is good to know these things beforehand. You don't know about these things? Don't worry, you will get some knowledge through this tutorial.
Note
This document was written for 0.3.8 so there are some differences from the current version (0.4.0). Major changes that you should know are:
- deprecated RubyCocoa syntax (see RubyCocoa Deprecated Stuff for more info)
- Fixed method names (centerized -> centered)
What this tutorial provides and what it doesn't
The game framework in MiniKidsGames provides the common code that is frequently written in simple game applications (e.g. creating a window, checking multiple key status). It also includes a game template for your convenient.
Thus, this tutorial focuses more on illustrating how to make a game by using the framework (including difference between programing with the game framework and with Cocoa frameworks). It also mentions some basic information in making a game such as drawing objects.
Since much hard work is done by the game framework (e.g. switching to full screen, speaking sounds, obtaining multiple key status, and creating the main window), this tutorial doesn't provide all the information that you need to make a game from scratch, but provides the information for making a game that runs on MiniKidsGames.
About the game you will make through this tutorial
The game you will make is called "TankGame." The objective of this game is to destroy all the enemy tanks (red tanks) before one of these crosses the borderline.
Your tank (blue) has a canon that can launch a cannon ball per one second. You move your tank left or right, adjusting the aiming sight and fire. If a canon hits a tank near its target point, the enemy tank is destroyed.
Have fun!
Table of Contents
- Get It Started
- Let It Draw
- Let It Move
- Let Them Move
- Let It Blow
- Let Them Fight
- Let It Sound
- Wrap It Up?








