最近才学的python,在网上找的贪食蛇游戏代码,运行的时候就出现错误 def gameOver(): gameOverFont = pygame.font.Font ('freesansbold.ttf', 72) gameOverSurf = gameOverFont.render ('Game Over', True, greyColor) gameOverRect = gameOverSurf.get_rect() gameOverRect.midtop = (320, 10) playSurface.blit(gameOverSurf, gameOverRect) pygame.display.flip() time.sleep(5) pygame.quit() sys.exit()
具体错误在这一行
gameOverRect = gameOverSurf.get_rect()
后面代码调用函数gameOver()的时候报错
AttributeError:'method_descriptor' object has no attribute 'get_rect' 请问大神们怎么解决,在线等!!!
带领世界来看你
_潇潇暮雨
相关分类