如何在 pygame 中制作动画

我正在尝试制作我的玩家何时被击中的动画,以使他看起来像是倒在地上。


我已经尝试了下面的代码,但这似乎不起作用。它减慢了帧的速度并且只显示我的动画的最后一张图像在 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)

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


守着星空守着你
浏览 145回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python