Titanium

Gaming comes to Titanium, Introducing the Box2D module!

box2d.png

The community has long been asking “Can I build games like angry birds or <insert any game title here> with titanium” and for some situations there were ways to make it work, but it always involved a lot of hacks.

We know game development is important to many developers, and so we wanted to bring better game development to you.

It is our great pleasure to introduce to you the new open source Box2d Module for Titanium Mobile!

Let me outline what this module is, and what it is not…

First of all, this is an open source, 100% free module, this means that any Titanium developer has access to both the compiled module, as well as the source to make changes (and in turn, submit pull requests to give back to the community).

Another point to note is that the module does not currently support all of the Box2D APIs, it does however support what we consider to be the core elements such as bodies (square and round), collision detection, gravity, static and dynamic bodies, revolute joints and motors and more!

This is a native Obj-C module, this means native speeds, this also however means that this module is currently iOS only, we do have plans however to build an Android version of the module down the road.

We have uploaded the module source, as well as a pre-compiled version in zip format to our open source modules repo

So with the release of this new open source Box2D module, we thought it would be nice to show you a little bit of what it can do!

To demo this new module, we decided it would be fun to build a pinball game, that we now call TiBall.

Screen Shot 2011-09-07 at 10.36.31 AM.png

This open source game will show how to use the majority of the APIs currently available in the module, and will continue to be developed as an example app by Appcelerator.

So how do you get started?

  1. Download the games source files here
  2. Download the new Box2D module here
  3. Now you have 2 options, you can build the module from source if you desire to make any changes, or use the included compiled module in the zip directory named ti.box2d-iphone-0.9.zip, to use the pre-built module, simple unzip the file. You should now have a folder called modules. Inside that folder there will be another folder called iphone. Inside the iphone folder there should be another folder called ti.box2d. Copy the ti.box2d folder to your /Library/Application Support/Titanium/modules directory. (note that it is in the root Library, not the one based off of the users folder) If there is not an iphone folder already inside the modules folder, create it.
  4. Now, simply import the TiBall game into Titanium Studio and run it in the iOS simulator
  5. The first screen of the game will provide you with instructions on how to play, as well as a button to start a new game.

 

We here at Appcelerator are very excited to release this module, this game,to  see what the community can do with it, and create using it!