Greetings!

The main purpose of this website is to support Android indie game developers with tutorials, reviews and promotion of their games. The main difficulty for the developers is not to make the game, but to get exposure. To get it out there. If you find anything useful here, please spread the word. Like my page on Facebook, follow me on Google+ or Twitter. Thank you!

Google+ Facebook Twitter

× close
Showing posts with label squong. Show all posts
Showing posts with label squong. Show all posts

Wednesday, 5 March 2014

Android Game Development Tutorial in AndEngine - Part X - Taking a break, source code available

Due to my demanding full-time job and a few part-time activities such as writing a book about AndEngine (it has been published!), I must take a break from writing the tutorial. The game is complete and I actually published it. You can find it in Google Play store.

If you have followed the tutorial and would like to see how the final code looks like, you can. I am offerring the source code for download for 99¢ (that is about $1 :)).




Features

A lot of important features of AndEngine were used. The list includes but is not limited to:

  • Resource Management, loading and unloading of resources
  • Scene management - Splash, Menu, Loading, Game and Ad Scene. The Loading scene is animated, using asynchronous task
  • Sprites, tiled sprites and simple animations. Entity factories.
  • Physics, bodies with multiple fixtures, collisions with filtering. Mouse joint.
  • Music, sounds.
Read more »

Tuesday, 5 November 2013

Android Game Development Tutorial in AndEngine - Part 5 - Resource Loading and Splash Screen


This part will show you how to load assets to memory and how to use them in a scene.

It's important to preload some resources, especially those that will be used all the time, but you can't load too many resources at once simply because you might run out of memory and the gamers could run out of patience waiting for everything to load. It is equally important to unload those resources that are no longer needed.

For the purpose of preloading resources a splash screen is usually displayed first. It is not necessary, but first you can show your brand or name and second it will give users something to look at while you are loading the resources in the background. You can also show some kind of progress bar, but splash works just fine.
Read more »

Tuesday, 29 October 2013

Android Game Development Tutorial in AndEngine - Part 4 - Scenes and Scene Manager


In the third part we have created an empty activity. We have set the engine to show "null" as our scene in onCreateScene method. If you check the examples, there is always a real scene created in this method. But we want to have multiple scenes and therefore we need a mechanism how to switch between them.

Also we will need a mechanism to pass important objects to each scene. We can do it when constructing scenes. Or we can use another class called ResourceManager.

Resource manager

This class will be used for our resources like textures, sounds and music. Because all of our scenes will be using it extensively, we will also put some important objects there. Loading the textures etc will be described in the next parts, I will be adding them as they will be needed. For now, create a really simple Resource Manager that looks like this:



package is.kul.squongtutorial.resources;

import is.kul.squongtutorial.GameActivity;

import org.andengine.engine.Engine;
import org.andengine.engine.camera.Camera;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

public class ResourceManager {
  private static final ResourceManager INSTANCE = new ResourceManager();
  
  //common objects
  public GameActivity activity;
  public Engine engine;
  public Camera camera;
  public VertexBufferObjectManager vbom;
  
  private ResourceManager() {}
  
  public static ResourceManager getInstance() {
    return INSTANCE;
  }
  
  public void init(GameActivity activity) {
    this.activity = activity;
    this.engine = activity.getEngine();
    this.camera = engine.getCamera();
    this.vbom = engine.getVertexBufferObjectManager();
  }
}


Update the GameActivity to instantiate the ResourceManager:


  @Override
  public void onCreateResources(
      OnCreateResourcesCallback pOnCreateResourcesCallback)
      throws IOException {
    ResourceManager.getInstance().init(this);
    pOnCreateResourcesCallback.onCreateResourcesFinished();
  }


This class follows what we call Singleton pattern. It means there can be only one instance in the whole program. That's why there is the private constructor, nobody else can create a new instance. It is important to have only single resource manager because due to the limitations of the hardware, you really want to keep only one instance of assets in memory.

For now, we will only use it to have a simple reference to activity, engine, camera and vertex buffer object manager.

Vertex Buffer Object is part of OpenGL. It provides methods to render vertex data. AndEngine does great job of hiding this from you. Simply use the VBO Manager all the time, at least for your first game.

Scene is basically a set of entities that are being currently displayed. You typically want to have completely different entities in menu and in the game. And that's why you create menu scene and game scene.
Read more »