Getting started with game development & Titanium

Copy space. New arrows painted on asphalt. Direction future.

Editor’s note: Sharry Stowell is the editor of Learning Titanium, where he frequently comments on the latest contributions of the Titanium community.

Mobile gaming

The mobile gaming industry is huge. Did you know that in 2011, 70-80% of all mobile downloads were games? That Angry Birds has been downloaded 140 million times? Or that it’s estimated that by 2015, mobile gaming is going to hit $54,000,000,000 (yep, that’s $54 billion!)1? Do you want a little slice of that cake?

Help is on the way to Titanium developers, thanks to people like Kota Iguchi who developed QuickTiGame2d. This tool allows developers to create 2D games on Titanium quickly, using tools like TexturePacker, Tiled Map Editor and Particle Designer. I interviewed Kota last month on LearningTitanium, he is the developer of emo-framework (a lightweight 2D game framework for Android and iOS driven by Squirrel, an object-oriented scripting language for game logic).


After being impressed with the Ti.Box2D module, Kota decided after search for existing Titanium gaming engines and the performance of of OpenGL on Titanium to use his knowledge of games programming to create ‘QuickTiGame2d’. Being a port of Ti.Box2D you can use QuickTiGame2d’s Box2d with almost same manner as Ti.Box2D2!  Kota has developed multiple open source projects, the 1st was QuickTiBall which was based on the TIBall.  This allows elements like gravity, velocity, static/dynamic sprites/scores/collision detection to name just a few.

QuickTiGame2d provides very simple gaming API. Please see below for example:

// Obtain game module
var quicktigame2d = require('com.googlecode.quicktigame2d');

// Create view for your game.
var game = quicktigame2d.createGameView();

// Frame rate can be changed (fps can not be changed after the game is loaded)
game.fps = 30;

// Initialize your game scene
var scene = quicktigame2d.createScene();

// Create your sprites and add them to the scene
var background = quicktigame2d.createSprite(
  {image:'background.png', width:640, height:960, x:0, y:0}

var sprite = quicktigame2d.createSprite({image:'ball.png'});

// Sprite sheet is supported
var tiles = quicktigame2d.createSpriteSheet(
  {image:'tiles.png', width:32, height:32}

// Add sprites to the scene

// Set sprite opacity to 50%
sprite.alpha = 0.5;

// Rotate sprite in 30 degree

// Scale up the sprite by twice

// Z-order can be changed
background.z = 0;
sprite.z     = 1;

// Called when the game is loaded
game.addEventListener('onload', function(e) {"your game is loaded");

  // Change position of your sprite
  sprite.x = game.screen.width  * 0.5;
  sprite.y = game.screen.height * 0.5;

  // Select first frame of sprite sheet
  tiles.frame = 0;

  // sprite sheet animation is also supported
  tiles.animate([0, 1, 2], 500);


// Called when the game enters frame
game.addEventListener('enterframe', function(e) {
  // Change position of your sprite
  sprite.x = sprite.x + 1;

  // Rotate your sprite
  sprite.rotate(sprite.angle + 6);

// Called when user taps screen
game.addEventListener('singletap', function(e) {
  // Note that size of our view may change due to the layout of parent view
  // so we have to take the scale into account to process touch event.
  var scale = game.screen.width / game.width;

  // Change position of your sprite
  sprite.x = e.x * scale;
  sprite.y = e.y * scale;



Another great project Kota built was QuickTiShooter, a shooting game written in about 250 lines of javascript.  When you touch the screen, your ship will move in that direction and bullets are fired automatically. Check out the video of QuickTiShooter – there is even the option to turn to 3d mode in the 2nd video!


QuickTiGame2dExample in my personal opinion is the best usage of Titanium gaming yet!  Using a tile map built with the help of MapEditor, Kota has used the Tile Map in the background as a kind on RPG game, where the screen followers the character around.


Here is a video of the game in action:

Whilst speaking to Kota over a number of hours you can really tell a persons passion, especially when he only started javascript a few months ago! Why not give game development a try!

#UPDATE: Kota is already on his next update which will include a ‘isometric tiled map‘ (like FarmVille/CityVille by Zynga) and sounds effects on events/collisions:



  1. Hi !

    This is really exiting to see the growing capabilities of titanium with the modules, Unfortunately, i haven’t found any reference of all the methods availables with the ‘com.googlecode.quicktigame2d’ . is there’s one existing ?


  2. How the heck do I download the source for something like QuickTiShooter, I get to a google page and nowhere can I find a way to download the code, I can see it in my browser, but thats it. HELP!

    • @Stephen, when you get to the Google Code page, click on the “Downloads” link at the top of the page. Then choose the download from the list.

Comments are closed.