Q:

Object methods from pygame.sprite.Group()

I have a couple of sprite groups checking for collisions with each other and I want to access the method of one member of  the sprite group as follows...
for hit in pygame.sprite.groupcollide(badSprites, Missiles, 0, 1):
     hit.health(100)
     hit.printMessage("NO")

For some reason the hit.printYes method works but the hit.health one gives me a type error

TypeError: 'int' object is not callable

Here's the method inside my colliding object...
def health(self, damage):
    self.damage = damage
    self.health -= damage
    return self.health
def printMessage(self, message):
    print(message)

As you can see I just want to alter the health of the object when it collides with the missile but it appears I can only pass strings not numbers. I tried sending "100" as a string and then type casting inside health() but that didn't work either. Perhaps my code is wrong elsewhere.

A:

You can't have a method with the same name as a property, change the method to set_health or something similar

