예제 #1
0
파일: person.py 프로젝트: induane/harrenrpg
    def create_spritesheet_dict(self, sheet_key):
        """Make a dictionary of images from sprite sheet."""
        image_list = []
        image_dict = {}
        sheet = setup.GFX[sheet_key]

        image_keys = [
            'facing up 1',
            'facing up 2',
            'facing down 1',
            'facing down 2',
            'facing left 1',
            'facing left 2',
            'facing right 1',
            'facing right 2'
        ]

        for row in range(2):
            for column in range(4):
                image_list.append(
                    self.get_image(column*32, row*32, 32, 32, sheet))

        for key, image in izip(image_keys, image_list):
            image_dict[key] = image

        return image_dict
예제 #2
0
파일: attack.py 프로젝트: induane/harrenrpg
    def make_image_list(self):
        """
        Make a list of images to cycle through for the
        animation.
        """
        image_list = []

        for row in range(8):
            for column in range(8):
                posx = column * 128
                posy = row * 128
                new_image = self.get_image(posx, posy, 128, 128,
                                           self.spritesheet)
                image_list.append(new_image)

        return image_list
예제 #3
0
 def make_select_menu_pos_list(self):
     """Make the list of possible arrow positions."""
     pos_list = []
     for i in range(3):
         pos = (35, 443 + (i * 45))
         pos_list.append(pos)
     return pos_list
예제 #4
0
    def make_select_action_pos_list(self):
        """Make the list of positions the arrow can be in."""
        pos_list = []

        for i in range(4):
            x = 590
            y = (i * 34) + 472
            pos_list.append((x, y))

        return pos_list
예제 #5
0
파일: battle.py 프로젝트: induane/harrenrpg
    def make_enemies(self):
        """Make the enemies for the battle. Return sprite group."""
        pos_list = []
        for column in range(3):
            for row in range(3):
                x = (column * 100) + 100
                y = (row * 100) + 100
                pos_list.append([x, y])

        enemy_group = pg.sprite.Group()

        if self.game_data['battle type']:
            enemy = person.Enemy('evilwizard', 0, 0, 'down', 'battle resting')
            enemy_group.add(enemy)
        else:
            if self.game_data['start of game']:
                for enemy in range(3):
                    enemy_group.add(
                        person.Enemy('devil', 0, 0, 'down', 'battle resting'))
                self.game_data['start of game'] = False
            else:
                for enemy in range(random.randint(1, 6)):
                    enemy_group.add(
                        person.Enemy('devil', 0, 0, 'down', 'battle resting'))

        for i, enemy in enumerate(enemy_group):
            enemy.rect.topleft = pos_list[i]
            enemy.image = pg.transform.scale2x(enemy.image)
            enemy.index = i
            enemy.level = self.make_enemy_level_dict()[self.previous]
            if enemy.name == 'evilwizard':
                enemy.health = 100
            else:
                enemy.health = enemy.level * 4

        enemy_list = [enemy for enemy in enemy_group]

        return enemy_group, pos_list[0:len(enemy_group)], enemy_list
예제 #6
0
    def make_select_magic_pos_list(self):
        """
        Make the coordinates for the arrow for the magic select screen.
        """
        pos_list = []
        text_list = self.info_box.make_magic_text()
        text_list = text_list[1:]

        for i in range(len(text_list)):
            left = 90
            top = (i * 29) + 488
            pos_list.append((left, top))

        return pos_list
예제 #7
0
파일: person.py 프로젝트: induane/harrenrpg
    def make_wander_box(self):
        """
        Make a list of rects that surround the initial location
        of a sprite to limit his/her wandering.
        """
        x = int(self.location[0])
        y = int(self.location[1])
        box_list = []
        box_rects = []

        for i in range(x-3, x+4):
            box_list.append([i, y-3])
            box_list.append([i, y+3])

        for i in range(y-2, y+3):
            box_list.append([x-3, i])
            box_list.append([x+3, i])

        for box in box_list:
            left = box[0]*32
            top = box[1]*32
            box_rects.append(pg.Rect(left, top, 32, 32))

        return box_rects