Tag Info

New answers tagged


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]


I wouldn't even try to use pixel perfect collisions for this. Given the fact that you've got a limited and fixed amount of possible tiles as well as pretty simple rules ("allow player to leave the tile in some direction or not"), I'd just work with a bitmask/property for your tiles. For example, you could create an enum with the possible directions: enum ...


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

Top 50 recent answers are included