How to create a simple 2D game for Android?

Hamed Momeni picture Hamed Momeni · Apr 24, 2014 · Viewed 81.8k times · Source

I'm a complete newbie when it comes to game development and I need someone to point me to the right direction.
For the sake of clarity please consider the following animation. simple zombie game animation

Basically I need to know how to emulate the above animation as an Android game but I don't know the steps necessary to do as such. My questions can be summarized as follow:

  • Do I need to use a Game Engine for such simple games?
  • Or it can be done without the use of any particular framework?
  • Do I need to use an animation application such as Adobe Flash?
  • What are the necessary steps to make this kind of game?

Answer

free3dom picture free3dom · Apr 26, 2014

Using a game engine or not is a preference. It will depend on what exactly you are after. If you want to learn about the underlying concepts of rendering, collision detection, etc, then writing these yourself is perfectly acceptable, and a lot of fun. On the other hand, if you just want to get the game done without having to worry about the details then an engine is definitely the way to go.

Game engines range from very basic wrappers (which usually provides easier functions that take care of low level tasks) to highly complex abstractions in which the actual game development no longer resembles any specific platform - they also sometimes allow you to create the game once and deploy it to various platforms without any changes.

To implement a game based on that animation you might use the following:

  • For each non-player character create a series of consecutive "frames" which when cycled gives the illusion of movement. These can be created in any graphics application (preferably in a texture map/atlas).
  • For the player character, you will need an animated sequence for each "move", such as kick, punch, etc. Then play the correct sequence when the player triggers some action (ex. play the kick sequence when the player pushes a kick button).
  • Each character should have a bounding box (i.e. a rectangle that defines the size and position of the character). The player character should probably have a different sized box based on the type of attack (i.e. the box for the kick action would extend farther to the right than the box for the punch action.
  • Randomly spawn characters at the right of the screen and move them at some speed (based on type?) towards the player. During each iteration, test for collisions between the player and each non-player's bounding boxes. If a collision is found, check if the player is kicking or punching and kill the character that was hit, if the player is not attacking maybe damage him/her.

That is a very basic description of your problem and should give you enough ideas to research in order to implement a basic version :)

Some game engines you might want to look into:

If you are interested in learning about making android games specifically, have a look at this book: