So it turns out, AndEngine is a pain in the neck to learn…
As mentioned on many places around the web, AndEngine’s main disadvantage is that there is no available documentation. Most people also say however that there is a very helpful community out there to support you and provide tutorials to help you along the way. Unfortunately one must bear in mind that the second version of AndEngine (GLES2.0) was released in December 2011, so any tutorials written before that date may contain code that will not work if you are trying to use the latest version of the engine.
So my most of my day has been dedicated to research, and filtering through all sorts of AndEngine stuff on the web. I have been through the whole setup process already to get the engine working on one of the university lab computers (which wasnt easy because the lab systems only have Android 2.1 and 2.2). Thanks have to go out to RealMayo and his set of tutorials. Ive downloaded his copy of AndEngine from github and managed to get it working without too much trouble.
After installation comes the learning process. Now there is a lot of information out there on how to do X and Y with AndEngine, but not much on how to design the architecture of a game. Eventually, I stumbled across Jimmar’s Invaders Clone Tutorial which not only gave me a great understanding of the game architecture in AndEngine, but was also relevant to GLES2.0.
So I had a read, and began coding up my first implementation of TouchMagic. The resultant architecture works as follows:
- Create a class which extends BaseGameActivity. This works pretty much like a normal Android activity, so it also needs to be registered in the AndroidManifest.xml file. You set up the Overriden methods as normal, creating a camera and a scene which in most cases will be the opening splash scene for the game.
- Create setCurrentScene in your BaseGameActivity. This two lined method handles the swapping of different scenes within the game
- Create all the scenes for the game. And then swap between them as required with setCurrentScene.
And that is basically it. BaseGameActivity is used as a controller to administer several different scenes in a game (like the splash screen, main menu, and the game itself). Currently I am unsure why one would want to then have multiple activities within their game, but I may find out why later. As of now though, TouchMagic has a Splash screen, menu screen, and a simple game where one can drag a sprite around the screen. I think its time to call it a day