Again this question is on PyParticles4.
Link to last question for reference
Comment if unclear...
I am working on a Shooter game, much like this, but on a flat land with a wall that varies it's height on every turn(something for fun in the game) and with 2 players,each with a cannon that can move some distance (there's a limit, and they can't move beyond a certain amount from their start position) on each turn(the player decides if he wishes to move).
My code:
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()).
My Problems
Collision of the bullet with the Wall. Any Ideas on how to know when the bullet hits the wall?
I think something faster would be better..
Also, if the ball hits the wall, the ball should bounce back so it has a chance to hit the player who shot it at first(Strong Wall!), and so the wall doesn't get cut, like in the game(mentioned at the start).