玩家跳跃时玩家按键不会响应

所以我一直在我的玩家的两侧工作,我做到了,我只是遇到了这个问题,那就是当我的玩家在尝试移动时跳跃时,我的玩家不会响应我按下的键。仅当玩家开始跌倒时按键才会响应。


gyazo.com/17bd10445460cd358c6dba4d99e106a7


当这种情况发生时,很难跳转到其他平台,在我让我的玩家触摸平台的侧面后,它就开始发生。


我不确定它发生在哪里,但这就是我让我的玩家跳跃的地方


        # Jumping

        if collide:

            if keys[pygame.K_SPACE]:

                playerman.isJump = True

                py -= playerman.speed

            playerman.fall = 0


慕盖茨4494581
浏览 97回答 1
1回答

至尊宝的传说

循环忽略跳跃时的 X 运动。改变这个:if not playerman.isJump and player_rect.collidelist(platform_rect_list) < 0:&nbsp; &nbsp; &nbsp; &nbsp; playerman.x = px对此:# if not playerman.isJump and&nbsp;if player_rect.collidelist(platform_rect_list) < 0:&nbsp; &nbsp; playerman.x = px
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python