Skip to main content
 首页 » 编程设计

python之如何在pygame中制作动画

2024年12月31日10wuhuacong

<分区>

我正在尝试制作我的球员何时被击中的动画,让他看起来像是倒在地上。

我试过下面的代码,但似乎不起作用。它会减慢帧速度并且只显示我动画的最后一张图像 pygame 中有更简单的动画方式吗?

    if player2_hit_sequence == True: 
        stage1 = True 
        if stage1 == True: 
            game_display.blit(dying1_p2, (player2X, player2Y)) 
            time.sleep(0.2) 
            stage1 = False 
            stage2 = True 
        if stage2 == True: 
            game_display.blit(dying2_p2, (player2X, player2Y)) 
            time.sleep(0.2) 
            stage2 = False 
            stage3 = True 
        if stage3 == True: 
            game_display.blit(dying3_p2, (player2X, player2Y)) 
            time.sleep(0.2) 

是否有制作一系列图像之类的功能?