PyGame rect.move movement not functioning properly
Solution 1:
pygame.Rect.move
doesn't change the Rect
object itself, but it returns an new Rect
object (Probably the name of the method is misleading).
This means, that
self.rect.move(xy[0], xy[1])
doesn't change anything. You've to assign the rectangle which is returned by .move
to "itself":
self.rect = self.rect.move(xy)
Alternatively you can use pygame.Rect.move_ip()
, moves the rectangle "in place" and changes the Rect
object:
self.rect.move_ip(xy[0], xy[1])