Hi,

I am writing a simple game. I created a sprite sheet for animations,
and I can move the character on the screen left and right. The
character animation graphics on the sprite sheet are all facing
"right".

My approach to make the character face to a different direction is to
created a flipped version of the sprite sheet, and draw the character
depending on its orientation:

        playerBitmap = BitmapFactory.decodeResource
(res,sprite_drawable_rid);

        sprite_sheet_width = playerBitmap.getWidth();
        sprite_sheet_height = playerBitmap.getHeight();

        Matrix aMatrix = new Matrix();
        aMatrix.preScale(-1.0f, 1.0f);
        flippedPlayerBitmap =
                Bitmap.createBitmap(playerBitmap, 0, 0,
                                                        sprite_sheet_width, 
sprite_sheet_height,
                                                        aMatrix, false);

...................................
                if (isFacingLeft()) {
                        c.drawBitmap(flippedPlayerBitmap, src, dst, null);
                }
                else {
                        c.drawBitmap(playerBitmap, src, dst, null);
                }

But when the character change direction, the character "flick"
obviously. I am not sure if it is because I don't have an animation
for the transition, or technically I am doing something stupid. Anyone
has any ideas??

thx!
Ron
--~--~---------~--~----~------------~-------~--~----~
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