Answer the question
In order to leave comments, you need to log in
Drag and drop sprite without "cloning" in Pygame?
I want to drag the image from one position to another without having to clear the back surface every pass in the loop thanks to screen.fill(BLACK), since the background is not a solid color
while run:
for event in pygame.event.get():
pos = pygame.mouse.get_pos()
if event.type == pygame.QUIT:
run = False
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
run = False
if event.type == pygame.MOUSEMOTION:
#screen.fill(BLACK)
screen.blit(img, [pos[0], pos[1]])
pygame.display.flip()
pygame.quit()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question