|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码:
- font = pygame.font.Font(None, 20)
- health = font.render(str(hero.energy), True, pygame.color.Color(255, 255, 255), (0, 0))
- screen.blit(health)
复制代码
报错:- Traceback (most recent call last):
- File "C:\Users\WL\PycharmProjects\pythonProject1\飞机大战\飞机大战\main.py", line 120, in <module>
- main()
- File "C:\Users\WL\PycharmProjects\pythonProject1\飞机大战\飞机大战\main.py", line 90, in main
- health = font.render(str(hero.energy), True, pygame.color.Color(255, 255, 255), (0, 0))
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ValueError: invalid color argument
复制代码
- health = font.render(str(hero.energy), True, pygame.color.Color(255, 255, 255), (0, 0))
复制代码
最后那个(0, 0)少了一个参数吧.而且直接Color就好了吧
- health = font.render(str(hero.energy), True, pygame.Color(255, 255, 255), pygame.Color(0, 0, 0))
复制代码
试试看
|
|