Beispiel #1
0
from items import Item, load_animations


animations = load_animations('data/items/', 'life_small')


class LifePotionSmall(Item):

    def __init__(self, pos):
        super(LifePotionSmall, self).__init__(pos)

        self.animations = {name: animation.getCopy() for name, animation in animations.items()}
        self.animation = None
        self.set_animation('touch')
        self.position = pos


    def touched_by(self, character):
        super(LifePotionSmall, self).touched_by(character)

        dis = self.distance_to(character)
        if not self.taken and dis < 20:
            if 'hit' in character.animation_name:
                character.life = min(character.max_life, character.life + 3)
                self.kill()
                self.taken = True


Beispiel #2
0
from items import Item, load_animations

animations = load_animations('data/items/', 'axe')


class Axe(Item):
    def __init__(self, pos):
        super(Axe, self).__init__(pos)
        self.animations = {
            name: animation.getCopy()
            for name, animation in animations.items()
        }
        self.animation = None
        self.set_animation('touch')

    def touched_by(self, character):
        super(Axe, self).touched_by(character)

        dis = self.distance_to(character)
        if not self.taken and dis < 20:
            if 'hit' in character.animation_name:
                character.weapon = 'axe'
                self.kill()
                self.taken = True
Beispiel #3
0
from items import Item, load_animations

animations = load_animations('data/items/', 'knife')


class Knife(Item):
    def __init__(self, pos):
        super(Knife, self).__init__(pos)
        self.animations = {
            name: animation.getCopy()
            for name, animation in animations.items()
        }
        self.animation = None
        self.set_animation('touch')

    def touched_by(self, character):
        super(Knife, self).touched_by(character)

        dis = self.distance_to(character)
        if not self.taken and dis < 20:
            if 'hit' in character.animation_name:
                character.weapon = 'knife'
                self.kill()
                self.taken = True
Beispiel #4
0
from items import Item, load_animations


animations = load_animations('data/items/', 'sword')


class Sword(Item):

    def __init__(self, pos):
        super(Sword, self).__init__(pos)
        self.animations = {name: animation.getCopy() for name, animation in animations.items()}
        self.animation = None
        self.set_animation('touch')

    def touched_by(self, character):
        super(Sword, self).touched_by(character)

        dis = self.distance_to(character)
        if not self.taken and dis < 20:
            if 'hit' in character.animation_name:
                character.weapon = 'sword'
                self.kill()
                self.taken = True
Beispiel #5
0
from items import Item, load_animations

animations = load_animations('data/items/potions/life_small/')


class LifePotionSmall(Item):
    def touched_by(self, character):
        if character.life != character.max_life:
            character.life = min(character.max_life, character.life + 3)
            self.kill()