I'm having problems with sprites collision. I'm trying to use two different
methods (not at the same time) to get success but each version is throwing
up the same problem - each 'enemy' sprite is detected as colliding with the
player and being deleted.

I included the

self.rect = self.image.get_rect()

on the objects.

I have tried:

hits = pygame.sprite.spritecollide(player, enemy_list, True)print
"hits is this long: " + str(len(hits))for i in hits:
    player.damage()

but this just immediately kills off all my enemies.

Then I have tried:

for o in enemy_list:
    o.draw()
    if pygame.sprite.collide_rect(player, o)==True:
        print "careful " + str(player.health)
        player.damage()

but still again, nothing.

I then switched to a .jpg for the graphic, thinking that the images
themselves might help for detection, but I'm getting the same result.

What is the easiest way of detecting the collision between enemy and
player?

TIA

My whole code is visible at:
https://github.com/kabads/zoomr/blob/master/zoomr.py
--

http://kabads.monkeez.org
PGP key: 0x7111B833

Reply via email to