def __init__(self): """ Constructor function """ # Call the parent's constructor super(Player, self).__init__() # Create an image of the block, and fill it with a color. # This could also be an image loaded from the disk. width = 40 height = 80 #60 sprite_sheet = SpriteSheet("walk_red2.png") #sprite_sheet = SpriteSheet("p1_walk.png") # Load all the right facing images into a list self.image = sprite_sheet.get_image(0, 0, 40, 80) self.walking_frames_r = [] self.walking_frames_l = [] for i in range(10): image = sprite_sheet.get_image(i * 40, 0, 40, 80) self.walking_frames_r.append(image) image = sprite_sheet.get_image(i * 40, 80, 40, 80) self.walking_frames_l.append(image) self.imageFrame = 0 self.image = self.walking_frames_r[self.imageFrame] #self.image = pygame.Surface([width, height]) self.rect = self.image.get_rect() #self.image.fill(RED) # Set a referance to the image rect. self.rect = self.image.get_rect() # Set speed vector of player self.change_x = 0 self.change_y = 0 self.goLeft = False # List of sprites we can bump against self.level = None self.onAir = False