On 2/4/08, yoshi <[EMAIL PROTECTED]> wrote: > > Ok, I finally finished the core for the movement, attacking and > jumping for the right facing direction and I started implementing it > for the left facing direction. > I flipped the png with all the actions (I have one file with all the > actions in it, for each action the frames are set in a row), then when > I started 'cropping' it to put each frame into a list > using .get_region() I noticed that when blitted, the image was flipped > back to the original size. > When I blitted the file without cropping it, it was flipped, but the > cropped pieces have the original orientation. > Any idea why and how can I fix this ?
The get_region method doesn't know that you've messed with the texture coordinates. Either do your cropping before flipping, or create your own get_region method. The way this is working (flipping and cropping) is just by changing the texture coordinates assigned to the texture. An image covering the whole of an OpenGL texture has .tex_coords = (0, 0, 0, # bottom left 1, 0, 0, # bottom right 1, 1, 0, # top right 0, 1, 0) # top left For example, to crop off the left side of the image (leaving only the right half), you'd use: (.5, 0, 0, # bottom left 1, 0, 0, # bottom right 1, 1, 0, # top right .5, 1, 0) # top left The trick of flipping the image is to rearrange these numbers so the left and right coordinates are swapped. 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 -~----------~----~----~----~------~----~------~--~---
