pygame.display.update更新整个屏幕

问题描述

我创建了带有分屏的多人游戏。

我在左边绘制了第一个玩家(航天飞机,火弹,星星(滚动半滚动)和背景),然后更新了屏幕的第一部分。我对第二个玩家也一样。 但是大多数效果(例如星星)

x = -(self.scrollX / 2 % size[0])
y = -(self.scrollY / 2 % size[1])
screen.blit(self.stars_image,(int(x + pos),int(y)))

screen.blit(self.stars_image,(int(x + size[0] + pos),int(y + size[1])))

screen.blit(self.stars_image,int(y + size[1])))
# size is a tuple which contains the size allowed to the player
# pos is the x position of the part of the screen allowed to the player.

)从屏幕退出。

所以我需要使用pygame.display.update()

更新屏幕的一部分。

但是该命令无效,并更新整个屏幕。一切都重叠了。

我尝试过:

pygame.display.update(Rect((pos,0),size))

pygame.display.update(Rect((pos,size[0],size[1])))

pygame.display.update((pos,size[1]))

pygame.display.update(pos,size[1])

pygame.display.update((pos,size)

Rendering

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)