Hi,

I'm sorry if this is the wrong place to post this, but this was the
only place I could find to discuss pyglet programming.  I'm currently
trying to move a 2d game system over to pyglet from pygame.  In the
pygame code, collision is checked for using a bitmap, allowing the
level to contain arbitrary curves and still react correctly.  I am
trying to replicate this behavior.

The way I am currently doing it is as follows:  I read an image in
from file.  I convert that image to its data.  I take a region of the
data which is one pixel known to be fully transparent.  I change the
format for that region to 'A' (Alpha).  Then, whenever I'm checking
for collision, I take a one pixel region at the x and y coordinates,
convert the format of that to 'A', and compare the value of its data
to the value of the sample pixel's data.  If they aren't equal, a
collision has occurred.

Converting the format of an ImageData or ImageDataRegion is very
expensive, though, and slows my program down to a crawl.  Is there any
way to get the Alpha without performing this operation, or is there a
better way to do this?

Thanks,
Nate
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to