Take a look at the Canvas method drawBitmap()

http://developer.android.com/reference/android/graphics/Canvas.html#drawBitmap(android.graphics.Bitmap,%20android.graphics.Rect,%20android.graphics.Rect,%20android.graphics.Paint)

with that one you can specify the bitmap (the sprite sheet), the
subset of the bitmap you want to display (the current frame) and the
destination on the screen.

To make it animate you'll want to keep track of the amount of time
you've displayed the current frame, you can do this by updating a
counter by the amount of time that passes between each update call
e.g. when you update model position etc.  When it exceeds whatever
you've decided to be your frame-rate you change the current frame and
reset the timer.

I'll see if I can make some of my code a little more readable and post
it up later if you're still stuck.
On May 17, 4:23 pm, "g1port.com" <gmt...@gmail.com> wrote:
>         Hi guys,
>
>         For a 2D game programming, I'm trying to learn about loading
> an image file for all states of a game character (simply a walking
> soldier lets say) and simply animate it. I think this classic method
> is called as sprite imaging that you load whole image of all states of
> the character that you want to animate.
>
> Is there anyone that can provide some sample code about this or at
> least can you tell me which classes to use, how to refer some 'part
> of' whole image file and animate it etc.
>
>         Your help is much appreciated.
>
>         Thanks a lot.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to