Pygame make sprite walk in given rotation

Detect when the mouse is clicked with the MOUSEBUTTONDOWN event: if event.type == pygame.MOUSEBUTTONDOWN: mouse_x, mouse_y = event.pos Compute the vector from the center of the sprite to the mouse click position: dx = mouse_x – star.rect.centerx dy = mouse_y – star.rect.centery Compute the length of the vector (Euclidean distance): dist = math.sqrt(dx*dx + dy*dy) … Read more