2
\$\begingroup\$

I am new at Android game development. I have done some apps before, but none of them are games :)

So, I wanted to do a frame-by-frame animation of PNGs. I tried with AnimationDrawable, but OutOfMemory error comes quickly (I have a lot of PNGs). So I came upon SurfaceView. But I am stuck, because I really don't find any useful tutoirals/examples.

What is the best way to make an animation like this?

Here there already is a great answer to almost the same question, but all the links there don't work anymore.

I would really like to here suggestions how to make an animation frame-by-frame with PNGs in Android and if you have any tutorials or examples, I will be really happy :)

EDIT

I thought wrong about sprites, I think... Sorry, but I am a noob at game developing :) I have 60 PNG pictures (40kb, 427*420px each - on disk) which I would like to put in a animation. Is this even possible to do it with frame by frame animation?

The most similar and famous game that is close to mine is Talking Tom (but I don't know if they have frame-by-frame or any other method for animation).

\$\endgroup\$
4
  • 1
    \$\begingroup\$ The links are broken because someone linked to code search which was abandoned but the replica island codebase is still online: code.google.com/p/replicaisland/source/browse/trunk/src/com/… \$\endgroup\$
    – Chuck D
    Apr 6, 2012 at 15:44
  • \$\begingroup\$ Maybe if you make all your pngs fit in just one, as a sprite sheet, the OutOfMemory error may get fixed. \$\endgroup\$ Apr 6, 2012 at 16:28
  • \$\begingroup\$ Thanks for all, I think that replica island will be the best example! \$\endgroup\$
    – Trick
    Apr 7, 2012 at 11:01
  • \$\begingroup\$ Trick and @Rubber Mallet, thanks for the heads up about the links, I've updated my answer to the linked Android animation question. \$\endgroup\$ Apr 9, 2012 at 8:07

1 Answer 1

1
\$\begingroup\$

The Android APIs (like SurfaceView) are only really helpful for the simplest style of games like a simple puzzle game with no animations. If you are looking to create a game with a number of animated characters and any kind of complex gameplay, you're going to want to go another route. I suggest using OpenGL ES for the graphics and either a physics library like Box2D or build off of an existing engine like AndEngine. It really depends on what kind of game you want to make.

\$\endgroup\$
5
  • \$\begingroup\$ Box2D may require NDK, and programming Android apps on C++ may not be user-friendly at first... \$\endgroup\$ Apr 6, 2012 at 16:27
  • \$\begingroup\$ Not true, I'm currently writing a game with JBox2d without using the NDK. \$\endgroup\$
    – Amplify91
    Apr 6, 2012 at 16:29
  • \$\begingroup\$ So mention JBox2D instead of Box2D :O And also, I've heared that JBox2D isn't nice, cause garbage collector is not well implemented for games in android mobiles. That's why Box2D on C++ comes as an answer, YOU decide where the object gets deleted, so the game won't have "hiccups" . But anyway, this have nothing to do with the question (: \$\endgroup\$ Apr 6, 2012 at 16:37
  • 2
    \$\begingroup\$ JBox2D, like many other ports, is still Box2D. It's just a port so no need to get overly specific. As far as the Java v. C++ debate (far outside of the scope here), proper game programming in Java can completely avoid "hiccups" and improper garbage collection. Whether or not it's "well implemented" is up to the programmer doing the implementing. \$\endgroup\$
    – Amplify91
    Apr 6, 2012 at 20:56
  • \$\begingroup\$ Up to the programmer of course :) I will look into it, I am familiar with C++, so that is not a problem. \$\endgroup\$
    – Trick
    Apr 7, 2012 at 11:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .