Animated sprite

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

Animated sprite

Postby 3m3r1c » Tue Oct 06, 2009 7:54 pm

Hello everybody :)

Currently, I have problem to create an animated sprite.
I don't want use an AnimationDrawable because I don't think it's a good idea for my problem.
In fact I want take all sprites in a same .png like this example:
first, do you think I am right ? because there are also animation sprites if the guy is dying, is running and ect...
Thus Is it better use 40 .png(s) for one characters or a big one .png for each characters?

If i am right, the only possibility that I have find it's used an Bitmap with source rect and rect destination like this :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. canvas.drawBitmap(myAnimation, sourceRectangle, destinationRectangle, null);
Parsed in 0.012 seconds, using GeSHi

But what the difference with a drawable object because at this time I use drawable (speed, optimisation). Is it possible to create an drawable with Bitmap if we know the source rect ?

thank you for your help.
Posts: 9
Joined: Fri Sep 18, 2009 1:39 pm


Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 6 guests