Rss

Archives for : May2011

libgdx, box2d, tiled maps: full working example, part 1/3

This will be a 3 part post demonstrating how to make a simple side scrolling game using libgdx (official project blog), a cross-platform library that allows you to simultaneously build for the desktop and for Android devices.

Updated 2011-09-19: Updated to use libgdx 0.9.2. No code changes required.

Updated 2011-09-18: Updated to use libgdx 0.9.1 (for real this time…) which meant renaming the pack file, TiledMapRenderer to TileMapRenderer, moving and renaming the tiles and pack file (and reindexing) due to new requirements from libgdx.

Updated 2011-06-12: Fixed some graphical glitches reported by Ed (in part 2′s comments). Thanks for all of your help Ed! Additionally, the tutorial is now based on libgdx 0.9.1 (it might have been libgdx 0.9.0 at the time, sorry folks) instead of an arbitrary nightly build, and it uses a modified TexturePacker in place of “manual” pack file generation.

This example is for anyone interested in making Android games, but is unsure where to start. By the end of part 3 you will have a basic Mario-like side-scrolling game with realistic physics, and (hopefully) you will be able to take this example and build something fun.

I’ve learned a few things since writing my previous post on using Tiled Map Editor with libgdx that I’ll apply in this series, things that make building a simple tiled-map game a lot easier. All code found here is released under the Apache 2.0 license, meaning, basically, you can use it for whatever you want. (IANAL, read the license for details.)

This is a much more involved tutorial than you have seen before on this site. There are a lot of different components used here and I tried to avoid cutting corners during explanations.

Continue Reading >>