CREATE SPRITE CLASS: class GamePiece(pygame.sprite.Sprite): def __init__(self, image_file,center_location): pygame.sprite.Sprite.__init__(self) self.screen = pygame.display.get_surface() self.area = self.screen.get_rect() # Set up the sprite's image self.image,self.rect = load_image(image_file, -1) self.rect.center = center_location def update(self,position): self.rect.centerx = position[0] self.rect.centery = position[1] CREATE THE GAME PIECE GROUP (BEFORE THE MAIN WHILE LOOP): pieces = pygame.sprite.RenderUpdates() pieces.add(GamePiece("red-piece.png",(300,300))) # give the image file name and the initial position CREATE A GROUP FOR TRACKING THE GAME PIECE SELECTED BY THE MOUSE (BEFORE THE MAIN WHILE LOOP): piece_selected = pygame.sprite.GroupSingle() ADD THE FOLLOWING CODE TO THE EVENT CHECKING CODE: (When the mouse button is held down over a game piece, that piece is selected and dragged around as long as the mouse button is held down. When the mouse button is released, the game piece is let go. You can determine the validity of the location the game piece is moved to (replace valid_move = True with your own game rules). For example, if the game piece must be moved to a specific location. If the new location is not valid according to your game rules, the game piece returns to its original position before the mouse picked it up.) if event.type == pygame.MOUSEBUTTONDOWN: # select a piece piece_selected.add(piece for piece in pieces if piece.rect.collidepoint(event.pos)) pygame.event.set_grab(1) if len(piece_selected) > 0: piece_selected_original_position = (piece_selected.sprite.rect.centerx,piece_selected.sprite.rect.centery) elif event.type == pygame.MOUSEBUTTONUP: # let go of a piece # decide if the user has dragged the piece to a valid location (default is true) valid_move = True # set the piece's location based on the location's validity; the piece will return to its original location if it is not valid if valid_move: piece_selected.update(event.pos) else: piece_selected.update(piece_selected_original_position) # clean up for the next selected piece pygame.event.set_grab(0) piece_selected.empty() if pygame.event.get_grab(): # if there's a piece selected, drag it around with the mouse piece_selected.update(pygame.mouse.get_pos()) DRAW THE PIECES TO THE SCREEN (AFTER THE BACKGROUND IS DRAWN TO THE SCREEN): pieces.draw(screen)