I am trying to make a simple game(PONG) but I get an error when I run it. My code:
class Player1(pygame.sprite.Sprite):
def __int__(self):
pygame.sprite.Sprite.__int__(self)
self.image = pygame.Surface((10, 80))
self.image.fill(color_white)
self.rect = self.image.get_rect()
self.rect.left = 25
self.rect.centery = window_height
player1 = Player1()
game_window = pygame.display.set_mode((window_width,window_height))
all_sprites.draw(game_window)
I get an error but for pygame itself:
self.spritedict[spr] = surface_blit(spr.image, spr.rect)
AttributeError: 'Player1' object has no attribute 'image'
This is the line which is probably causing the 'object' does not have attribute 'image' error:
self.spritedict[spr] = surface_blit(spr.image, spr.rect)