每次吃鱼的时候,我都想让我的鱼变大,但我不确定为什么它不起作用,这就是我做的
其他一切都正常,但我的球员身高或宽度没有增加 video
# our main loop
runninggame = True
while runninggame:
clock.tick(fps)
for event in pygame.event.get():
if event.type == pygame.QUIT:
runninggame = False
#[...........]
for blac in blacs:
if playerman.rect.colliderect(blac.rect):
playerman.width += 10
playerman.height += 10
blac.x = 880
我的完整代码: https://pastebin.com/iL5h4fst
当大小减小时,需要使用^{} 缩放播放器的所有图像:
属性
self.width
和self.height
必须通过图像的缩小大小来初始化(image.get_width()//8
分别image.get_height()//8
)随着播放器的增长,您需要将播放器的大小乘以比例因子以保持纵横比。使用
pygame.transform.scale
时,将宽度和高度四舍五入为整数:相关问题 更多 >
编程相关推荐