if self.moving_backwards:
self.body.reverse()
# Also reverse the direction vector
self.direction = (-self.direction[0], -self.direction[1])
else:
# When switching back to forwards, reverse again to restore original orientation
self.body.reverse()
# Restore direction
self.direction = (-self.direction[0], -self.direction[1])
I don't think I need to explain the potential refactoring.
zahlman•2h ago