If I put the flipped character images in the same bitmap, then there will be no flickering switching between them.
So my question is why drawing from a different bitmap (flipped) will introduce flickering, while putting them all in the same sprite sheet and draw from the same bitmap will not?? I am using Lunar Lander as the base which uses SurfaceView, does it have something to do with the way it keeps two copies of back buffer and draw them alternatively?? thx!!! Ron On Dec 26 2008, 3:06 pm, ron <[email protected]> wrote: > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

