[英]Difference between rect.move() and rect.move_ip in pygame
我只是在官方文档中通过 pygame 的.rect
方法。 我们有2个案例,
pygame.rect.move(arg1,arg2)
用于在屏幕上移动.rect
object 和
pygame.rect.move_ip(arg1,arg2)
根据文档,它也用于在屏幕上移动.rect
object 但它将其移动到位
我不太明白这意味着什么。 谁能解释一下原地移动是什么意思?
“到位”是指 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.
注意, rect.move_ip
的返回值为None
,但rect.move
的返回值为一个新的pygame.Rect
object。
rect.move_ip(x, y)
和rect = rect.move(x, y)
一样
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.