【发布时间】:2020-03-10 12:31:55
【问题描述】:
这是我的背景网格的代码
Background = pygame.display.set_mode((900 ,900))
Green = (45,198,14)
Background.fill(Green)
for i in range(0, 900, 50):
pygame.draw.line(Background, (0, 0, 0), (0, i), (900, i))
pygame.draw.line(Background, (0, 0, 0), (i, 0), (i, 900))
pygame.display.update()
while pygame.event.wait().type != pygame.QUIT:
pass
我无法将任何图像加载到它上面,我必须将其转换为 n 个图像,然后是一个精灵,或者有没有办法让我将图像加载到网格上。我曾尝试使用 blit 功能,但它不会将图像放到网格上。
RedInfantry= pygame.image.load("H:\computer science\6.2\Coursework\Week\Red team\InfantryRedV20.gif").convert()
while True:
Background.blit(RedInfantry,(0,0))
如果我将图像变成精灵,它是否允许我移动和删除网格上的图像? 我是否必须在图像中创建网格才能将其他图像粘贴到它上面。
【问题讨论】:
标签: python image pygame sprite