I have put in the code self.rect = pygame.Rect(x, y, 100, 100)
. There is an AttributeError: type object 'MobRow1' has no attribute 'rect'
. Why does this error keep popping up when I have put the rect
in.
I have tried self.rect = pygame.Rect(self.x, self.y, 100, 100)
This still doesn't work.
class MobRow1(pygame.sprite.Sprite):
def __init__(self, x, y):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load(badguy_file).convert_alpha()
self.image = pygame.transform.scale(self.image, (50, 50))
self.x = x
self.y = y
self.rect = pygame.Rect(x, y, 100, 100)
self.mask = pygame.mask.from_surface(self.image)
def update(self):
self.rect.y += self.speedy
self.rect.x += self.speedx