问题
I was just going through the .rect method of pygame in the official docs.
We have 2 cases ,
pygame.rect.move(arg1,arg2) which is used to move a .rect object on the screen
and
pygame.rect.move_ip(arg1,arg2) which is , according to the docs, also used to move a .rect object
on the screen but it moves it in place
I didnt quite get what it means. Can anyone explain what move in place means?
回答1:
"In place" means the object self.
While rect.move_ip changes the pygame.Rect object itself,
rect.move does not change the object, but it returns a new object with the same size and "moved" position.
Note, the return value of rect.move_ip is None, but the return value of rect.move is a new pygame.Rect object.
rect.move_ip(x, y) does the same as rect = rect.move(x, y)
来源:https://stackoverflow.com/questions/61578694/difference-between-rect-move-and-rect-move-ip-in-pygame