How to create a simple 2D game for Android? [closed]
Asked Answered
G

4

52

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?
Gunplay answered 24/4, 2014 at 16:1 Comment(3)
Far from simple that. Suggest you start with something much easier to learn a Game Engine.Grassquit
this should probably be moved to gamedev.stackexchange.comExpressway
In some realistic commercial sense, I'd say you'd do this currently with Unity3D. I'd personally wanna do it using Mixamo + Mecanim with actual 3D models (so it's "2.5D") which is all very "easy" (so to speak) in Unity. Note that then regarding Android/iPhone, you just press each button and Unity builds it either way for you. If you wanted to do this "traditionally" as literally 2D, I'd use Unity + 2DToolkit (makes animations trivial) + unity's PhysX which is all builtin and simple. The first step in your learning is to dig the difference between 2.5D and "real" 2D games; each has a place.Yeargain
F
45

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:

Feuchtwanger answered 25/4, 2014 at 22:25 Comment(3)
I really appreciate your effort in putting the details in your answer. Thanks to you I now have a general vision of the whole process.Gunplay
My pleasure :) Good luck with your game.Feuchtwanger
An interesting question is, is there an equivalent to "Sprite Kit" in the Android universe? I don't know.Yeargain
M
21

There are many game engines out there that can help you can get the job done.

Here is a link for all the mobile game engines out there.


Android 2D Game Engines

Cocos2D-x

Language: C++

Orientation: 2D

Difficulty: Intermediate


Corona SDK

Language: Lua

Orientation: 2D/3D

Difficulty: Intermediate


EDGELIB

Language: C++

Orientation: 2D

Difficulty: Intermediate


GameMaker

Language: None (Graphical)

Orientation: 2D

Difficulty: Easy


GameSalad

Language: None (Graphical)

Orientation: 2D

Difficulty: Easy


HaxeFlixel

Language: Haxe

Orientation: 2D

Difficulty: Intermediate


libGDX

Language: Java

Orientation: 2D/3D

Difficulty: Intermediate


Marmalade

Language: C++

Orientation: 2D/3D

Difficulty: Intermediate


Stencyl

Language: ActionScript (optional), Objective-C (optional)

Orientation: 2D

Difficulty: Intermediate


Unity3D

Language: JavaScript (UnityScript actually), C# (Mono)

Orientation: 2D/3D

Difficulty: Intermediate

Musil answered 19/8, 2014 at 1:8 Comment(2)
Correction. In Corona SDK language you write in is Lua. Worth mentioning is also fact that code written once can be compiled on iOS too.Needful
C++ is not used there at all :)Needful
G
3

I answer in the order you asked

  1. It is recommended to always use an engine, because they make the job easier, that's what they are for.

  2. You can do certain animations and movements without a framework, but it actually becomes more complex with the code and logic.

  3. Adobe Flash is useless on android. Most android devices do not run Flash without the user doing some things to get it.

  4. The steps that I recommend are

    • research some engines
    • review some frameworks
    • select and engine depending on the logic of your game
  5. Some engines are available for adventure games, puzzles, and other RPGs. Depending on your need go for one.

A few simple programs:

  • App Game Kit
  • Cocos2d for Android
  • Corona SDK
  • GameMaker
  • Stencyl

You can start with these. Unity is the best engine, but the most complicated too.

Gaskin answered 24/4, 2014 at 16:53 Comment(0)
S
0

I asked myself this question for about 10 years before finding a good answer, in my opinion, all gaming frameworks for android are still not quite mature or are a bit difficult to implement. I would recommend you used this. You'll be able to run your game in all devices out there (not only android). It's quite easy to learn if know the basics.

Here's a great Tutorial to get you started!

I made a game, using adobe's technology, you can check it out here.

Sentimentality answered 24/4, 2014 at 17:17 Comment(2)
Isn't Flash being deprecated? Does the games built using Adobe Game SDK require flash to play?Gunplay
Flash is! yes! but flash is not a programming language. The programming language is ActionScript3.0. You can compile it with either Flash or AIR. You would be using AIR. Your players don't need to install anything in their phones, they won't be able to distinguish your application from a native one. -Just make sure to compile it in captive runtime mode :)Sentimentality

© 2022 - 2024 — McMap. All rights reserved.