How can I drag more than 2 images in PyGame?
Create a list of 4 images: images = [img1, img2, img3, img4] Create a list of image rectangles: img_rects = [images[i].get_rect(topleft = (20+40*i, 20)) for i in range(len(images))] Use pygame.Rect.collidelist to find the image which is clicked: if e.type == pygame.MOUSEBUTTONDOWN: mouse_rect = pygame.Rect(e.pos, (1, 1)) current_image = mouse_rect.collidelist(img_rects) Draw the current_image: if e.type == … Read more