Tag Info

New answers tagged

1

Which version of PyGame were you using? An issue seems to have been fixed at some point between 1.9.1 and 1.9.2a concerning collide_circle() (see here for fix diff). It might be worth it to try 1.9.2a if possible (download/source here), which I believe isn't actually up on pygame.org. If you're on Linux or OS X you'll have to build 1.9.2a from source.


0

mouse_x,mouse_y = pygame.mouse.get_pos() color = some_surface_object.get_at((mouse_x,mouse_y)) will return array [0=>R, 1=>G, 2=>B] in demical values [122,25,224]


1

Use: pygame.Surface.get_at(x,y) to get a pixel RGBA value. http://www.pygame.org/docs/ref/surface.html#pygame.Surface.get_at


0

Without knowing more about your game and why you want to do this, you might go about it this way: At initialization, for every graphic drawn in your game, run it through a filter to find if they have that color in them at all. If it does, set a flag "hasThatColor" on the sprite and make a copy of them where you clear all pixels except the ones in that ...


1

convert() is used to convert the pygame.Surface to the same pixel format as the one you use for final display, the same one created from pygame.display.set_mode(). If you don't call it, then every time you blit a surface to your display surface, a pixel conversion will be needed - this is a per pixel operation, very slow - instead of a series of memory ...



Top 50 recent answers are included