1
每次清除屏幕时重绘每个图像都非常痛苦。防止图像被清除[PYGAME-Python]
import pygame
from pygame.locals import *
T = pygame.display.set_mode((500,500))
M = pygame.image.load("test.jpg")
X = 0
Y = 0
while True:
X += 1
Y += 1
# Other sprites are here which are also redrawn every time loop runs.
# Other code is here too, this is just a little part of it to help explain my problem
T.fill((0,0,0))
T.blit(M,(X,Y))
pygame.display.flip()
在上面的代码,我加载在M个可变背景图像,每次我清除屏幕更新我的精灵的位置,我也不得不重新绘制,这是造成严重的FPS下降的背景图像。
无论如何,我可以防止背景图像被清除,每当我使用T.fill((0,0,0))?
谢谢!第一个工作! –