Пример #1
0
    def draw(self, screen, world):
        if not world.view_grid.contains(self.location) and not world.view_grid.contains(self.next):
            return

        if world.grid_size != self.rect.width:
            self.rect.width = self.rect.height = world.grid_size
            self.image = Assets.load_image(self.image_path, (world.grid_size, world.grid_size))
        self.rect.x = (self.location.x - world.view_grid.x) * world.grid_size \
            + (self.next.x - self.location.x) * self.pct * world.grid_size
        self.rect.y = (self.location.y - world.view_grid.y) * world.grid_size \
            + (self.next.y - self.location.y) * self.pct * world.grid_size
        screen.blit(self.image, self.rect)
Пример #2
0
    def __init__(self):
        # References to draw
        self.image_path = ('character', 'human_sprite.png')
        self.image = Assets.load_image(self.image_path)
        self.name = Assets.names_db.random_full_name()
        #frm = display.font.render(str(frame), True, text_color)
        #rect = frm.get_rect()
        self.rect = Rect(0, 0, 0, 0)
        self.location = Rect(0, 0, 1, 1)
        self.target = Rect(50, 20, 1, 1)
        self.pct = 0.0
        self.next = Rect(self.location.x, self.location.y, 1, 1)

        # Traits and skills. General idea
        self.traits = {
            "health": 100,
            "intelligence": 0,
            "strength": 0,
            "mining": 0,
            "shooting": 0,
            "armour": 0,
            "weight": 0,
            "rotation": 0,
            "speed": 0,
            "versatility:": 0,
            "weight-capacity:": 0
        }

        # What the character has equipped
        self.equips = {
            "body_part_upper": None,
            "body_part_lower": None
        }


        # Condition: [inflicted?, Damage, Duration, Duration Remaining]
        self.conditions = {
            "Burn": [False, 1, 10, 0],
            "Frost": [False, 1, 15, 0],
            "Stun": [False, 1, 5, 0],
            "Sleep": [False, 1, 20, 0],
            "Shock": [False, 1, 3, 0],
            "Poison": [False, 1, 15, 0],
            "Bleed": [False, 1, 3, 0]
        }