def __init__(self, screen): sprite_sheet = SpriteSheet("Images/enemies.png") self.under_piranha = [] imagePop = pygame.transform.scale( sprite_sheet.get_image(390, 60, 19, 25), (32, 32)) self.under_piranha.append(imagePop) imagePop = pygame.transform.scale( sprite_sheet.get_image(420, 60, 19, 25), (32, 32)) self.under_piranha.append(imagePop) super().__init__(screen=screen, pop_list=self.under_piranha)
def addSpriteSheet(self, spriteName, filename, realSpriteSize, scaledSpriteSize, rowCount, columeCount): """Create a spritesheet and add it to the list of loaded images Real Sprite Size: The actual size of the image on disk Scaled Sprite Size: The size we want to scale the sprite to for the game""" spriteSheet = SpriteSheet(filename) self.loadedImages.update({spriteName: spriteSheet.load_grid((0, 0, realSpriteSize.x, realSpriteSize.y), columeCount, rowCount, Vector2(scaledSpriteSize.x, scaledSpriteSize.y), (255, 0, 255))})
def __init__(self, screen): sprite_sheet = SpriteSheet("images/enemies.png") self.goombas = [] self.goombas_died = [] image = pygame.transform.scale(sprite_sheet.get_image(0, 4, 16, 16), (32, 32)) self.goombas.append(image) image = pygame.transform.scale(sprite_sheet.get_image(30, 4, 16, 16), (32, 32)) self.goombas.append(image) # next image for squished goomba """image = pygame.transform.scale(sprite_sheet.get_image(60, 5, 16, 16), (30, 30)) self.goombas.append(image)""" super().__init__(screen=screen, walk_list=self.goombas)
def __init__(self, screen): sprite_sheet = SpriteSheet("Images/enemies.png") self.koopas_left = [] self.koopas_right = [] self.koopas_shell = [] imageRight = pygame.transform.scale(sprite_sheet.get_image(210, 0, 19, 25), (32, 32)) self.koopas_right.append(imageRight) imageRight = pygame.transform.scale(sprite_sheet.get_image(240, 0, 19, 25), (32, 32)) self.koopas_right.append(imageRight) imageLeft = pygame.transform.scale(sprite_sheet.get_image(179, 0, 19, 25), (32, 32)) self.koopas_left.append(imageLeft) imageLeft = pygame.transform.scale(sprite_sheet.get_image(149, 0, 19, 25), (32, 32)) self.koopas_left.append(imageLeft) imageShell = pygame.transform.scale(sprite_sheet.get_image(360, 0, 19, 25), (32, 32)) self.koopas_shell.append(imageShell) imageShell = pygame.transform.scale(sprite_sheet.get_image(360, 0, 19, 25), (32, 32)) self.koopas_shell.append(imageShell) super().__init__(screen=screen, walk_list_left=self.koopas_left, walk_list_right=self.koopas_right, shell_list=self.koopas_shell)
def __init__(self, screen): # list to hold all walking animations for right and left self.walk_right = [] self.walk_left = [] self.break_brick = False self.invincible = False # load right-facing images sprite_sheet = SpriteSheet("images/mario.png") image = pygame.transform.scale(sprite_sheet.get_image(210, 0, 15, 16), (32, 32)) self.walk_right.append(image) image = pygame.transform.scale(sprite_sheet.get_image(240, 0, 15, 16), (32, 32)) self.walk_right.append(image) image = pygame.transform.scale(sprite_sheet.get_image(270, 0, 15, 16), (32, 32)) self.walk_right.append(image) image = pygame.transform.scale(sprite_sheet.get_image(300, 0, 15, 16), (32, 32)) self.walk_right.append(image) image = pygame.transform.scale(sprite_sheet.get_image(360, 0, 15, 16), (32, 32)) self.walk_right.append(image) # load left-facing images image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(210, 0, 15, 17), (32, 32)), True, False) self.walk_left.append(image) image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(240, 0, 15, 17), (32, 32)), True, False) self.walk_left.append(image) image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(270, 0, 15, 17), (32, 32)), True, False) self.walk_left.append(image) image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(300, 0, 15, 17), (32, 32)), True, False) self.walk_left.append(image) image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(360, 0, 15, 17), (32, 32)), True, False) self.walk_left.append(image) super().__init__(screen=screen, walk_right=self.walk_right, walk_left=self.walk_left, break_brick=self.break_brick, invincible=self.invincible)
def __init__(self, screen): self.walk_right = [] self.walk_left = [] # ability flags self.break_brick = True self.invincible = False # load right-facing images sprite_sheet = SpriteSheet("images/mario.png") image = pygame.transform.scale(sprite_sheet.get_image(210, 52, 16, 32), (32, 64)) self.walk_right.append(image) image = pygame.transform.scale(sprite_sheet.get_image(240, 52, 16, 32), (32, 64)) self.walk_right.append(image) image = pygame.transform.scale(sprite_sheet.get_image(270, 52, 16, 32), (32, 64)) self.walk_right.append(image) image = pygame.transform.scale(sprite_sheet.get_image(300, 52, 16, 32), (32, 64)) self.walk_right.append(image) image = pygame.transform.scale(sprite_sheet.get_image(360, 52, 16, 32), (32, 64)) self.walk_right.append(image) # load left-facing images image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(210, 52, 16, 32), (32, 64)), True, False) self.walk_left.append(image) image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(240, 52, 16, 32), (32, 64)), True, False) self.walk_left.append(image) image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(270, 52, 16, 32), (32, 64)), True, False) self.walk_left.append(image) image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(300, 52, 16, 32), (32, 64)), True, False) self.walk_left.append(image) image = pygame.transform.flip(pygame.transform.scale(sprite_sheet.get_image(360, 52, 16, 32), (32, 64)), True, False) self.walk_left.append(image) super().__init__(screen=screen, walk_right=self.walk_right, walk_left=self.walk_left, break_brick=self.break_brick, invincible=self.invincible)