【发布时间】:2014-07-12 10:02:43
【问题描述】:
我试图让 shootRect 出现在 playerRect 的中间,并且在前面一个像素。在代码中,我尝试绘制 shootRect
我的代码:
MESH = ((playerRect.x + 1), (playerRect.x + 1), ((playerRect.topleft.y + playerRect.bottomleft.y) / 3), ((playerRect.topleft.y + playerRect.bottomleft.y) / 2))
shootRect = (screen, WHITE, MESH)
if event.type == KEYDOWN:
if event.key == ord(' '):
pygame.draw.shootRect
错误:
Traceback (most recent call last):
File "C:\Users\***\***\***\***.py", line 76, in <module>
MESH = ((playerRect.x + 1), (playerRect.x + 1), ((playerRect.topleft.y + playerRect.bottomleft.y) / 3), ((playerRect.topleft.y + playerRect.bottomleft.y) / 2))
AttributeError: 'tuple' object has no attribute 'y'
【问题讨论】:
-
尝试打印
playerRect.topleft看看会发生什么
标签: python python-3.x pygame tuples