我正在为我的游戏制作一个帮助屏幕,每当我运行它时,我都会收到这条错误消息:
self.surface.blit(self.helpscreen) TypeError:参数1必须是> pygame.Surface,而不是pygame.Rect
我不知道如何解决它,我仍然在学习游戏,所以我需要一个相当基本的答案,如果可能的话。我的代码如下:
def help(self):
pygame.init()
self.FPS = 60
self.fps_clock = pygame.time.Clock()
self.surface = pygame.display.set_mode((640, 480))
helpscreen = DISPLAY_SURF.fill(white)
self.surface.blit(helpscreen)
# This class sets the basic attributes for the window.
# The clock is set to 60 and the name of the window
# is set to The Hunt which is a working title for my project
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
while True:
pygame.display.update()
self.fps_clock.tick(self.FPS)
self.process_game()发布于 2018-01-05 21:57:47
只需填充显示面self.surface.fill(white)或创建背景面并在self.surface上空白:
helpscreen = pygame.Surface(self.surface.get_size())
helpscreen.fill(white)
self.surface.blit(helpscreen, (0, 0))https://stackoverflow.com/questions/48120504
复制相似问题