【发布时间】:2020-08-14 12:22:15
【问题描述】:
我有一个问题:
screen.blit(tile, [(x*tilewidth) - CAMERA.x +(WIDTH/2) , (y*tileheight) - CAMERA.y + (HEIGHT/2)])
screen.blit(object.image, [object.x - CAMERA.x +(WIDTH/2), object.y - CAMERA.y + (HEIGHT/2)])
上面的代码产生错误:
DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated and may be removed in a future version of Python.
screen.blit(tile, [(x*tilewidth) - CAMERA.x +(WIDTH/2) , (y*tileheight) - CAMERA.y + (HEIGHT/2)])
程序启动但随后由于错误而崩溃。我该如何解决这个问题?
【问题讨论】:
-
WIDTH/2导致浮动。尝试整数除法:WIDTH // 2 -
结果还是一样
-
问题解决了吗?
-
是的,你帮我