title: Is there equivalent function of collidepoint for color?
body: <p>I'm making a 2D game in order to learn python and pygame. The goal will be to control a red point and to get out of a dungeon. I'm making a map generator composed of rectangles and rectangles won't be the same color as the surface.</p>
  
  <p>Is it possible to make my red point move only on the surface color (black) for exemple ?
  With some collidepoint function or equivalent ?</p>
  
  <p>I did a little code for exemple:</p>
  
  <pre class="lang-py prettyprint-override"><code>
  import pygame
  
  pygame.init()
  
  X = 750
  Y = 750
  
  BLACK = (0,0,0)
  RED = (255,0,0)
  WHITE = (255,255,255)
  
  done = False
  
  screen = pygame.display.set_mode((X,Y))
  
  X_circle = 375
  Y_circle = 375
  
  
  def mainloop():
      global BLACK, WHITE, RED, X, Y, done, screen, X_circle, Y_circle, Xmove, Ymove
  
      pygame.key.set_repeat(1,20)
  
      while not done:
          for event in pygame.event.get():
              Xmove = 0
              Ymove = 0
  
              screen.fill(BLACK)
              circle = pygame.draw.circle(screen, RED, (X_circle,Y_circle), 15)
              Rect_WHITE = pygame.draw.rect(screen, WHITE, (300, 200, 44, 46))
              pygame.display.update()
  
  
              if event.type == pygame.KEYDOWN:
                  if event.key == pygame.K_KP4:
                      Xmove = -5
                  elif event.key == pygame.K_KP6:
                      Xmove = 5
                  elif event.key == pygame.K_KP8:
                      Ymove = -5
                  elif event.key == pygame.K_KP5:
                      Ymove = 5
  
              if (X_circle+Xmove&lt;750 and X_circle+Xmove&gt;0):
                  X_circle+=Xmove
              if (Y_circle+Ymove&lt;750 and Y_circle+Ymove&gt;0):
                  Y_circle+=Ymove
  
              pygame.display.update()
  
              if event.type == pygame.QUIT or (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
                  pygame.quit()
                  quit()
  
  mainloop()
  pygame.quit()
  quit()
  
  </code></pre>