title: how to put an image onto a sprite pygame
body: <p>I am creating a game like pacman in pygame using python. I want to assign a image of a jewel to the <code>jewel</code> class. In the maze 'J' Represents the <code>jewel</code>. So just to make it clear how would i assign an image to the Jewel Class so that all the J's in the maze map are that image?</p>
  
  <p>The class for the jewel is </p>
  
  <pre><code>class Jewel(object):
      """Class to hold Jewel sprite properties"""
  
      def __init__(self, pos):
          jewels.append(self)
          self.rect = pygame.Rect(pos[0], pos[1], 16, 16)
  </code></pre>
  
  <p>The class for the wall and maze is </p>
  
  <pre><code>class Wall(object):
      """Class to hold Wall sprite properties"""
  
      def __init__(self, pos):
          walls.append(self)
          self.rect = pygame.Rect(pos[0], pos[1], 16, 16)
  
  walls = [] #List to contain walls
  jewels = []#List to contain Jewels
  
  #!-----------------------Maze Layout----------------------!
  
  #Table used to create the level, where W = wall
  level = [
  "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
  "W       J               W          JJJ           W",
  "W                       W     W                  W",
  "W    WWWW   WWWWW   WWWWW     W      WWWWWWWWWW  W",
  "W    W          W       W     W           W      W",
  "W    W      JJJJ        W   WWWWWWW       W      W",
  "W    W   WW                    W          W      W",
  "W    W    W     WWWW           W          W      W",
  "W    WWW  W     W  W           W  W   WWWWW      W",
  "W         W                    W  W              W",
  "WWWW      WWWWWWWWWWWWWWWWWWWWWW                 W",
  "W  W     WW                    W                 W",
  "W       WW                     W WWWWWWWWWWWWWWWWW",
  "W             WWW              W                 W",
  "W   WW               WW  WWW   W                 W",
  "W    W  WWW          WWWWWWW   WWWWWWWWWWWWWWWW  W",
  "W    W    W   WWW       WW         W          W  W",
  "W    WW   W                            W      W  W",
  "W     W   W          WWWWWWWWWWWWWWWWWWWWWWWW W  W",
  "WWWW      WWWWW      WW  WWW                  W  W",
  "W  W      W                W  WWWWWWWWWWWWWWWWW  W",
  "W  W   WWWW     W  W       W     W               W",
  "W      W           W  WWW  W            W        W",
  "W      WWWW        W  W    WWWWWWWWWWWWWWWWWWWWWWW",
  "W  WW     W   WWW  W  W      JJJ                 W",
  "W   W     W        W  W                     J    W",
  "W   W   WWW           W    WWW                   W",
  "W  WWW       WWWWWWWWWW      WWWW                W",
  "W    W       W                  WWWWWWW    W     W",
  "WW   W    WWWW        WWWWWW          WWWW WWWW  W",
  "WJ   W                   W            W    W     W",
  "W     W  J    WWW           WWWWW    W    W  WWWW",
  "WWW   W        W      W               W WWWW     W",
  "W W       WWWWWW   WWWW               W    W     W",
  "W WWW     W        W         WWWWW    WWWW WWWWW W",
  "W       WWW        W     W               W       W",
  "W       W                W               W       W",
  "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
  ]
  
  #Draw the wall rects as shown in the table above
  x = y = 0
  for row in level:
      for column in row:
          if column == "W":
              Wall((x, y))
          if column == "J":
              Jewel((x, y))
          x += 16
      y += 16
      x = 0
  
  #Draw walls and jewels
      for wall in walls:
          pygame.draw.rect(screen, (WHITE), wall.rect)
  
      for jewel in jewels:
          pygame.draw.rect(screen, (BLUE), jewel.rect)
  </code></pre>