2D monster truck game I made (open source)

Post your tutorials and samples here.
Posts: 1
Joined: Sat Jun 02, 2012 1:49 pm

2D monster truck game I made (open source)

Postby sebnil » Sat Jun 02, 2012 1:57 pm


A while ago I started programming a game for android. Since I do not have time to finish it I thought it would be better to publish the results so far. I rather see the game finished and not collecting dust in my private repository and that is why I decided to open source it.

Project site: http://sebastiannilsson.com/en/projekt/ ... i-android/

The game is similar to the MX Mayhem a monster truck instead of a bike.
This video shows the latest code:

Library and technology used
  • Andengine
  • Box2d extension
  • Physics editor (physicseditor.de)

Working now
  • Andengine and box2d extension.
  • Basic physics. Car behaves quite good but improvements can be made.
  • Tilting of mobile accelerometer. Tilting to the left and right will add a small rotating torque on the car..
  • Worlds are created from editing xml files. I have created a xml structure to more easily generate new worlds. The world generation will ofcourse need improvements

Spagetti code
You are free to make improvements in code structure if you want. I would recommend some cleanup since this is one of my first android projects.

The separation between levels and the game engine
Right now you just add a new folder to add a new level to the game. Therein is the XML and image files and this makes it possible to create new tracks without touching the engine. See world.xml for an example:
https://github.com/sebnil/Sketchy-Truck ... /world.xml

Examples of the folder structure of a level: https://github.com/sebnil/Sketchy-Truck ... els/level1
shapes.xml contains shapes from physicseditor. world.xml contains objects and background. Gfx contains graphics. Quite simple.

Tested on
I have tested on HTC Desire, Google Galaxy Nexus and Samsung S2. Should work well on most modern devices.

Source code and Copyright
Use the code in any way you think is best but please help make it better. If you make a change that is good then make sure to send it to the Github project. The goal of me posting this is to make the game better and closer to actuelly being on the market (for free). If you use the code to something else (such as a material in a tutorial 2d andengine) please leave a reference to either the blog or the git repository.

A todo:
  • Remove unused assets, pictures, sounds, etc..
  • Menus do not look good.
  • Add z-index of parallax backgrounds. Specify in xml with “zindex = #”.
  • Different speeds of parallax backgrounds. .
  • Engine sounds are awful.
  • The shape of the car seems a little wrong. When you roll with the car the contact points do not look ok..
  • Add icon (s)
  • Remove load time when restarting.
  • When clicking menu button the game should be paused and menu opened.
  • When clicking back button ingame you should get back to the level select menu and not end the game..
  • Add a stopwatch and highscores.

Return to “Tutorials and Samples”

Who is online

Users browsing this forum: No registered users and 1 guest