我如何使我的敌人子弹袭击更好? pygame

问题描述 投票:-1回答:1

最近,我在帮助子弹攻击玩家方面有所帮助,但是它只是击中了玩家的y轴,就像我的玩家跳过子弹不会攻击一样,它只会随y轴移动

[VIDEO就像我在中间一样,根本不会攻击玩家,只会攻击y轴

我的意思是,即使玩家跳动,我如何使它在玩家所走的任何方向上的攻击都更加顺畅

这里是子弹从敌人的枪支处射出并攻击与他接近的玩家的子弹,但不会攻击它的位置

            for shootss in shootsright:

                if shootss.x < 500 and shootss.x > 0:

                    if enemyshoots1.x < playerman.x:

                        shootss.x +=  5
                    else:
                        shootss.x -= 5
                else:
                    shootsright.pop(shootsright.index(shootss))
                if shootss.y < 500 and shootss.y >0:
                    if enemyshoots1.y < playerman.y:
                        shootss.y += 5
                    else:
                        shootss.y -= 5
                else:
                    shootsright.pop(shootsright.index(shootss))

            if len(shootsright) < 1:
                    shootsright.append(Bools(round(enemyshoots1.x+enemyshoots1.width-107),round(enemyshoots1.y + enemyshoots1.height-50),(0,0,0)))
                # projectile class for each of the bullets


python pygame
1个回答
0
投票

很难解码您要尝试做的或编写的内容,这不是任何人都可以自己运行的最低限度的代码,我花了两个视频甚至弄清您的“子弹”是他们的心。曲折曲折。

话虽如此,

© www.soinside.com 2019 - 2024. All rights reserved.