def __init__(self, game, pos):
     self.spritesheet = animation.SpriteSheet(
         game.images['homunculus'].copy())
     image = self.spritesheet.image_at((0, 35 * 2, 60 * 2, 45 * 2), -1)
     self.actions = {
         'idle':
         animation.SpriteStripAnim(self.spritesheet, (2, 0, 88, 122),
                                   6,
                                   colorkey=-1,
                                   loop=True,
                                   frames=10),
         'move':
         animation.SpriteStripAnim(self.spritesheet, (2, 121, 90, 124),
                                   6,
                                   colorkey=-1,
                                   loop=True,
                                   frames=10),
         'die':
         animation.SpriteStripAnim(self.spritesheet, (10, 370, 110, 138),
                                   4,
                                   colorkey=-1,
                                   loop=False,
                                   frames=10),
         'hit':
         animation.SpriteStripAnim(self.spritesheet, (10, 370, 110, 138),
                                   1,
                                   colorkey=-1,
                                   loop=False,
                                   frames=12)
     }
     Enemy.__init__(self, game, pos, image)
     self.health = HOMUNCULUS_HEALTH
     self.max_health = HOMUNCULUS_HEALTH
     self.atk = 7
     self.target = self.game.player
 def __init__(self, game, pos):
     self.spritesheet = animation.SpriteSheet(game.images['rumo'].copy())
     image = self.spritesheet.image_at((0, 0, 51, 79), -1)
     self.actions = {
         'idle':
         animation.SpriteStripAnim(self.spritesheet, (10, 0, 47, 75),
                                   6,
                                   colorkey=-1,
                                   loop=True,
                                   frames=10),
         'move':
         animation.SpriteStripAnim(self.spritesheet, (10, 75, 47, 75),
                                   6,
                                   colorkey=-1,
                                   loop=True,
                                   frames=10),
         'hit':
         animation.SpriteStripAnim(self.spritesheet, (10, 150, 47, 75),
                                   1,
                                   colorkey=-1,
                                   loop=False,
                                   frames=10),
         'die':
         animation.SpriteStripAnim(self.spritesheet, (10, 225, 64, 85),
                                   3,
                                   colorkey=-1,
                                   loop=False,
                                   frames=10) +
         animation.SpriteStripAnim(self.spritesheet, (203, 225, 50, 85),
                                   3,
                                   colorkey=-1,
                                   loop=False,
                                   frames=10)
     }
     Enemy.__init__(self, game, pos, image)
     self.health = RUMO_HEALTH
     self.max_health = RUMO_HEALTH
     self.atk = 3
     self.target = self.game.player
 def __init__(self, game, pos):
     self.spritesheet = animation.SpriteSheet(game.images['homun'].copy())
     image = self.spritesheet.image_at((9, 9, 65, 60), -1)
     self.actions = {
         'sleep':
         animation.SpriteStripAnim(self.spritesheet, (9, 9, 64, 60),
                                   4,
                                   colorkey=-1,
                                   loop=True,
                                   frames=20),
         'idle':
         animation.SpriteStripAnim(self.spritesheet, (265, 4, 64, 70),
                                   4,
                                   colorkey=-1,
                                   loop=True,
                                   frames=20),
         'move':
         animation.SpriteStripAnim(self.spritesheet, (7, 80, 67, 90),
                                   6,
                                   colorkey=-1,
                                   loop=True,
                                   frames=10),
         'attack':
         animation.SpriteStripAnim(self.spritesheet, (201, 85, 70, 90),
                                   3,
                                   colorkey=-1,
                                   loop=True,
                                   frames=10),
         'hit':
         animation.SpriteStripAnim(self.spritesheet, (0, 276, 90, 92),
                                   1,
                                   colorkey=-1,
                                   loop=False,
                                   frames=10),
         'die':
         animation.SpriteStripAnim(self.spritesheet, (0, 276, 90, 92),
                                   3,
                                   colorkey=-1,
                                   loop=False,
                                   frames=8) +
         animation.SpriteStripAnim(self.spritesheet, (270, 276, 97, 92),
                                   3,
                                   colorkey=-1,
                                   loop=False,
                                   frames=8)
     }
     Enemy.__init__(self, game, pos, image)
     self.health = HOMUN_HEALTH
     self.max_health = HOMUN_HEALTH
     self.atk = 11
     self.target = self.game.player
 def __init__(self, game, pos):
     self.groups = game.all_sprites, game.npc_sprites
     self.layer = PLAYER_LAYER
     self.ssheets = {'idle': animation.SpriteSheet(game.images['fp_idle'])}
     self.actions = {
         'idle':
         animation.SpriteStripAnim(self.ssheets['idle'], (30, 0, 32, 72),
                                   6,
                                   colorkey=-1,
                                   loop=True,
                                   frames=10)
     }
     self.action = 'idle'
     init_image = self.actions[self.action].images[0]
     Sprite.__init__(self, game, pos, init_image)  # inherit from Sprite
     self.actions[self.action].iter()
     self.hit_rect = FP_HIT_RECT.copy()
     self.refresh_rect()
Exemple #5
0
 def __init__(self, game, pos):
     self.groups = game.all_sprites, game.lit_sprites
     self.layer = PLAYER_LAYER
     self.ssheet_w = 200
     self.ssheet_h = 150
     self.ssheets = {
         'attack': animation.SpriteSheet(game.images['fj_sword_combo']),
         'idle': animation.SpriteSheet(game.images['fj_idle']),
         'run': animation.SpriteSheet(game.images['fj_run']),
         'sword1': animation.SpriteSheet(game.images['fj_found1']),
         'sword2': animation.SpriteSheet(game.images['fj_found2']),
         'sword3': animation.SpriteSheet(game.images['fj_found3']),
         'hit': animation.SpriteSheet(game.images['fj_hit'])
     }
     self.actions = {
         'attack':
         animation.SpriteStripAnim(self.ssheets['attack'],
                                   (0, 0, self.ssheet_w, self.ssheet_h),
                                   14,
                                   colorkey=-1,
                                   loop=False,
                                   frames=5),
         'idle':
         animation.SpriteStripAnim(self.ssheets['idle'],
                                   (0, 0, self.ssheet_w, self.ssheet_h),
                                   12,
                                   colorkey=-1,
                                   loop=True,
                                   frames=7),
         'run':
         animation.SpriteStripAnim(self.ssheets['run'],
                                   (0, 0, self.ssheet_w, self.ssheet_h),
                                   12,
                                   colorkey=-1,
                                   loop=True,
                                   frames=7),
         'hit':
         animation.SpriteStripAnim(self.ssheets['hit'],
                                   (0, 0, self.ssheet_w, self.ssheet_h),
                                   4,
                                   colorkey=-1,
                                   loop=False,
                                   frames=7),
         'sword':
         animation.SpriteStripAnim(self.ssheets['sword1'],
                                   (0, 0, self.ssheet_w, self.ssheet_h),
                                   12,
                                   colorkey=-1,
                                   loop=False,
                                   frames=7) +
         animation.SpriteStripAnim(self.ssheets['sword2'],
                                   (0, 0, self.ssheet_w, self.ssheet_h),
                                   8,
                                   colorkey=-1,
                                   loop=False,
                                   frames=7) +
         animation.SpriteStripAnim(self.ssheets['sword3'],
                                   (0, 0, self.ssheet_w, self.ssheet_h),
                                   6,
                                   colorkey=-1,
                                   loop=False,
                                   frames=7)
     }
     self.action = 'idle'
     init_image = self.actions[self.action].images[0]
     sprites.Sprite.__init__(self, game, pos,
                             init_image)  # inherit from Sprite
     self.hit_rect = PLAYER_HIT_RECT.copy()
     self.hit_rect_offset = vec(0, 50)
     self.atk_rect = None
     self.health = PLAYER_HEALTH
     self.invun = False
     self.uber = False
     self.max_health = PLAYER_HEALTH
     self.facing = 'right'
     self.light_mask = self.game.light_mask.copy()
     self.light_rect = self.light_mask.get_rect()
     self.actions[self.action].iter()
     self.refresh_rect(offset=self.hit_rect_offset)
     self.refresh_poly()