Creative Pact Day 1: AndEngine Physics pt 1

For Creative Pact 2010 I’m going to be teaching myself how to make a game using the open source AndEngine for Android mobile devices.  apparently, Android apps are the next goldrush, the biggest thing since skinny jeans, and I never got a pair of skinny jeans so I might as well jump in the deep end here.

Firstly, I already blogged about starting with AndEngine, so I won’t repeat myself here.  I’ll instead start with my current app, which is going to be a physics-based game with draggable characters.

AndEngine uses Box2D under the hood as its physics engine, which you can find here in project form.  Of course, you don’t need to download the project unless you want to see the source code (which can be useful as I couldn’t find any javadocs as of yet).  You can instead use the Java jar that comes with the main AndEngine project from GoogleCode.

To get started, I imported the main AndEngine project into Eclipse (New Project->Android Project->create from existing source) and followed the 5 minute video on starting a project in Eclipse, then dragged one of the Physics example Activities from the main project into my new game project (called, funnily enough, GameTest).

The next bit caught me – I need to drag the andenginephysicsbox2dextension.jar (whew… what a name) into my lib folder from the AndEngine main project, and also create a libs folder in my new project and then drag the from the main project’s libs folder into my new libs folder.  If you don’t do this, you will get immediate, fatal errors every time you launch your new app.  Of course, in hindsight, this seems perfectly obvious, doesn’t it?

Ok, finished the app but ran out of time to explain – here is the code and all that fun.

Try installing the apk on your phone!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.