On Jan 29, 2008 1:09 AM, yoshi <[EMAIL PROTECTED]> wrote:
>
> Is there any way that I can flip an image horizontally. I need this
> for a platformer game I`m trying to make and I need the character
> image to flip horizontally when the walking direction changes from
> left to right or the other way.
> It'd save me a lot of trouble having to use 2 different images for the
> same animation but different facing.
> Here's an example of what I need
> http://img142.imageshack.us/img142/3804/duckcy5.png
>
> It'd be nice if there was something like image.horizontal_flip() or
> something but I couldn`t find anything like that :(
It's already implemented for pyglet 1.1 ;-) In the meantime:
from pyglet import image
face_left = image.load('person.png').texture
face_right = face_left.get_region(0, 0, face_left.width, face_left.height)
t = face_right.tex_coords
face_right.tex_coords = t[3:6] + t[:3] + t[9:] + t[6:9]
Alex.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" 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/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---