这个问题再次出现在PyParticles4上 .
Link to last question for reference
评论如果不清楚......
我正在制作一个射击游戏,就像this一样,但是在一个平坦的土地上,每一个转弯都有一个不同的墙,并且它们不能从他们的起始位置移动超过一定数量(玩家决定是否他希望搬家) .
我的代码:
class Bullet(PyParticles.Particle):
def hit_s(self,shooterlist):
for shoot in shooterlist:
#collision with the rect
dist = math.hypot(dx,dy)
def hit_w(self,wall):
-------------------------
#confusion
-------------------------
# other funcs to added
class Shooter:
def __init__(self,pos,size):
self.rect = pygame.Rect(pos,size)
# other funcs to added
class Wall:
def __init__(self,(sx,sy),(ex,ey),width):
self.start = (sx,sy)
self.end = (ex,ey)
self.width = width
# (things needed for pygame.draw.line()).
我的问题
子弹与墙壁的碰撞 . 关于如何知道子弹击中墙壁的任何想法?
我认为更快的东西会更好..
此外,如果球击中墙壁,球应该反弹,这样它就有机会击中最初射击它的球员(强墙!),因此墙壁不会像游戏中那样被切断(提到在开始时) .