0
I’m trying to add layers to my game window, so I tried using Sprite groups, but there’s this mistake that I don’t understand why it persists:
TypeError: 'module' object is not callable
I searched and it seems to happen when a function and a variable have the same name, but in my code there is no function or variable with the same name.
sprite = pygame.sprite.Group()
green = (0, 255, 0)
class Block (pygame.sprite.Sprite):
def __init__ (self, color, width, height):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.surface((width, height))
self.image.fill(color)
self.rect = self.image.get_rect()
self.rect.x = x/2
self.rect.y = y/2
quadrado = Block(green, 50, 50)
sprite.add(quadrado)
I was trying to import an image, but gave this problem and summarized to rect.
There is no way to clone in the code a comment indicating the line where the interpreter points the error. And in case the error message is more verbose attach to the message.
– Augusto Vasques