按下多个键时改变移动速度

问题描述

我正在尝试使用pygame制作一个简单的射击游戏,但我很好奇。 按下方向键使形状移动。 在这里,如果您先按向右方向键和向左方向键, 如何以比向右方向键低的速度向右移动? 这是我的原始码

while True:
    clock.tick(60)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()       
    pressed=pygame.key.get_pressed()
    if pressed[pygame.K_LEFT]:
        player_left=1
        pos_x -=6
        if player_left==1 and pressed[pygame.K_RIGHT]:
            player_left=0
            pos_x-=3  

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)