我如何制作一个一个者的面具?
我可以做一个直接的面具,如果是的话,如何?我正在试图在面具和矩形之间发生碰撞,并且由于我无法做一个面具(那时没有像素的完美碰撞),所以我想我会问我是否可以做一个一个emect的口罩?像鉴于尺寸和x/y的矩阵一样,我该如何基于此制作面具?
Can I make a mask of a rect, if so, how? I'm trying to make collisions between a mask and a rect, and since I can't make a rect of a mask(No pixel perfect collision then) I figured I'd ask if I could make a mask of a rect? Like given the dimensions and x/y positon of a rect, how could I make a mask based on that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建
pygame.mask.mask.mask.mask.mask.mask
对象并将所有位设置为 <<<代码> fill()使用
pygame.mask.mask.mask.overlap
用于掩模对象之间的碰撞检测。方法重叠()
的偏移参数是elethmask
与pygame.mask.mask.mask.mask.mask.mask
object。例如:
对象1:
x1
,y1
,mask1
对象2:
x2
,y2
,mask2
另请参阅 pygame与蒙版碰撞 和。
Create a
pygame.mask.Mask
object and set all bits 1 withfill()
Use
pygame.mask.Mask.overlap
to for the collision detection between Mask objects. The offset parameter of the methodoverlap()
is the relative position of theothermask
in relation to thepygame.mask.Mask
object.e.g.:
object 1:
x1
,y1
,mask1
object 2:
x2
,y2
,mask2
See also PyGame collision with masks and Pygame mask collision.
您可以使用
width
和高度
的高度you can create a
pygame.mask.Mask
using thewidth
andheight
of the rect object: