Exemple #1
0
class Face(Element):
    __slots__ = ('_anms', 'side')

    def __init__(self, anms, effect, side):
        Element.__init__(self, (-32, -16))

        self._anms = anms
        self.sprite = Sprite()
        self.anmrunner = ANMRunner(self._anms[0][0][0], side * 2, self.sprite)
        self.side = side
        self.load(0)
        self.animate(effect)

        #FIXME: the same as game.effect.
        self.sprite.allow_dest_offset = True


    def animate(self, effect):
        self.anmrunner.interrupt(effect)


    def load(self, index):
        self.sprite.anm, self.sprite.texcoords = self._anms[self.side][index]


    def update(self):
        self.anmrunner.run_frame()
Exemple #2
0
    def __init__(self, pos, back_anm=None, back_script=22):
        Element.__init__(self, pos)
        self.changed = True
        self.frame = 0

        # Set up the backround sprite
        self.back_anm = back_anm
        if back_anm:
            self.sprite = Sprite()
            self.anmrunner = ANMRunner(back_anm, back_script, self.sprite)
Exemple #3
0
    def __init__(self, pos, anm, max_length=280, maximum=1, value=0):
        Element.__init__(self, pos)
        self.sprite = Sprite()
        self.anmrunner = ANMRunner(anm, 21, self.sprite)
        self.sprite.corner_relative_placement = True  #TODO: perhaps not right

        self.max_length = max_length
        self.maximum = maximum

        self.set_value(value)
Exemple #4
0
    def __init__(self, anm, index, player):
        Element.__init__(self)

        self.sprite = Sprite()
        self.anmrunner = ANMRunner(anm, index, self.sprite)

        self.offset_x = 0
        self.offset_y = 0

        self.player = player
Exemple #5
0
    def __init__(self, anms, effect, side):
        Element.__init__(self, (-32, -16))

        self._anms = anms
        self.sprite = Sprite()
        self.anmrunner = ANMRunner(self._anms[0][0][0], side * 2, self.sprite)
        self.side = side
        self.load(0)
        self.animate(effect)

        #FIXME: the same as game.effect.
        self.sprite.allow_dest_offset = True
Exemple #6
0
class Gauge(Element):
    def __init__(self, pos, anm, max_length=280, maximum=1, value=0):
        Element.__init__(self, pos)
        self.sprite = Sprite()
        self.anmrunner = ANMRunner(anm, 21, self.sprite)
        self.sprite.corner_relative_placement = True #TODO: perhaps not right

        self.max_length = max_length
        self.maximum = maximum

        self.set_value(value)


    def set_value(self, value):
        self.value = value
        self.sprite.width_override = self.max_length * value / self.maximum
        self.sprite.changed = True #TODO


    def update(self):
        #XXX
        if self.value == 0:
            self.sprite.visible = False
        else:
            self.sprite.visible = True
        if self.anmrunner is not None and not self.anmrunner.run_frame():
            self.anmrunner = None
Exemple #7
0
class Gauge(Element):
    def __init__(self, pos, anm, max_length=280, maximum=1, value=0):
        Element.__init__(self, pos)
        self.sprite = Sprite()
        self.anmrunner = ANMRunner(anm, 21, self.sprite)
        self.sprite.corner_relative_placement = True  #TODO: perhaps not right

        self.max_length = max_length
        self.maximum = maximum

        self.set_value(value)

    def set_value(self, value):
        self.value = value
        self.sprite.width_override = self.max_length * value / self.maximum
        self.sprite.changed = True  #TODO

    def update(self):
        #XXX
        if self.value == 0:
            self.sprite.visible = False
        else:
            self.sprite.visible = True
        if self.anmrunner is not None and not self.anmrunner.run_frame():
            self.anmrunner = None
Exemple #8
0
class Orb(Element):
    def __init__(self, anm, index, player):
        Element.__init__(self)

        self.sprite = Sprite()
        self.anmrunner = ANMRunner(anm, index, self.sprite)

        self.offset_x = 0
        self.offset_y = 0

        self.player = player

    def update(self):
        self.anmrunner.run_frame()
        self.x = self.player.x + self.offset_x
        self.y = self.player.y + self.offset_y
Exemple #9
0
    def __init__(self, pos, back_anm=None, back_script=22):
        Element.__init__(self, pos)
        self.changed = True
        self.frame = 0

        # Set up the backround sprite
        self.back_anm = back_anm
        if back_anm:
            self.sprite = Sprite()
            self.anmrunner = ANMRunner(back_anm, back_script, self.sprite)
Exemple #10
0
    def __init__(self, pos, anm, max_length=280, maximum=1, value=0):
        Element.__init__(self, pos)
        self.sprite = Sprite()
        self.anmrunner = ANMRunner(anm, 21, self.sprite)
        self.sprite.corner_relative_placement = True #TODO: perhaps not right

        self.max_length = max_length
        self.maximum = maximum

        self.set_value(value)
Exemple #11
0
 def build_models(self):
     self.models = []
     for obj in self.stage.models:
         quads = []
         for script_index, ox, oy, oz, width_override, height_override in obj.quads:
             sprite = Sprite(width_override, height_override)
             anm_runner = ANMRunner(self.anm, script_index, sprite)
             quads.append(
                 (ox, oy, oz, width_override, height_override, sprite))
             self.anm_runners.append(anm_runner)
         self.models.append(quads)
Exemple #12
0
    def __init__(self,
                 pos,
                 anm,
                 back_anm=None,
                 ref_script=0,
                 xspacing=14,
                 back_script=22):
        Widget.__init__(self, pos, back_anm, back_script)

        self.ref_sprite = Sprite()
        self.anm = anm
        self.glyphes = []
        self.xspacing = xspacing

        # Set up ref sprite
        ANMRunner(anm, ref_script, self.ref_sprite)
        self.ref_sprite.corner_relative_placement = True  #TODO: perhaps not right
Exemple #13
0
class Widget(Element):
    def __init__(self, pos, back_anm=None, back_script=22):
        Element.__init__(self, pos)
        self.changed = True
        self.frame = 0

        # Set up the backround sprite
        self.back_anm = back_anm
        if back_anm:
            self.sprite = Sprite()
            self.anmrunner = ANMRunner(back_anm, back_script, self.sprite)

    def normal_update(self):
        if self.changed:
            if self.anmrunner is not None and not self.anmrunner.run_frame():
                self.anmrunner = None
            self.changed = False
        self.frame += 1
Exemple #14
0
class Widget(Element):
    def __init__(self, pos, back_anm=None, back_script=22):
        Element.__init__(self, pos)
        self.changed = True
        self.frame = 0

        # Set up the backround sprite
        self.back_anm = back_anm
        if back_anm:
            self.sprite = Sprite()
            self.anmrunner = ANMRunner(back_anm, back_script, self.sprite)

    def normal_update(self):
        if self.changed:
            if self.anmrunner is not None and not self.anmrunner.run_frame():
                self.anmrunner = None
            self.changed = False
        self.frame += 1