def run_background_script(actor, a, b, c, d): s = Script(loop=0) s.addAction(actions.DelayRandom(min=a, max=b)) s.addAction(actions.Animate(tag=actor, anim='idle_2', fwd=True, sync=True)) s.addAction(actions.DelayRandom(min=c, max=d)) s.addAction(actions.Animate(tag=actor, anim='idle_2', fwd=False, sync=True)) s.addAction(actions.Animate(tag=actor, anim='idle_1', fwd=True, sync=True)) example.play(s)
def f(): def g(): State.variables[var] = 'closed' s = script.Script() s.addAction(act.Animate(anim='closed', tag=doorId)) s.addAction(act.CallFunc(f=g)) return s
def f(): def g(): setattr(State.md.doors, var, 'open') #State.variables[var] = 'open' s = script.Script() s.addAction(act.Animate(anim='open', tag=doorId)) s.addAction(act.CallFunc(f=g)) return s
def bonusBrickResponse (player: example.Wrap1, brick: example.Wrap1, x, y): b = brick.parent() info = b.getInfo() hitsLeft = info['hitsLeft'] brick_id = b.id() if hitsLeft > 0: info['hitsLeft'] -= 1 s = Script() ystop = b.y() s.addAction (act.MoveAccelerated (v0 = [0, 50], a = [0, 0.5 * vars.gravity], yStop = ystop, id = brick_id)) if hitsLeft == 1: s.addAction (act.Animate (anim='taken', id=brick_id)) # release the bonus def p(): info['callback'](b.x()/ vars.tileSize + 0.5, b.y() / vars.tileSize) s.addAction (act.CallFunc (f = p)) example.play(s)
sc.addAction(sa.Say(lines=lines, tag=b[0])) return sc return f # a: animate forward - async # ab: aimate backward - async # A: animate forward - sync # Ab: animate backward - async # d: delay # (...) lines to say # dialogue with anim control # supercool and quick way to create a dialogue d3h = { 'a': lambda tag, c : actions.Animate (anim = c, tag = tag, fwd = True, sync = False), 'ab': lambda tag, c : actions.Animate (anim = c, tag = tag, fwd = False, sync = False), 'A': lambda tag, c : actions.Animate (anim = c, tag = tag, fwd = True, sync = True), 'Ab': lambda tag, c : actions.Animate (anim = c, tag = tag, fwd = False, sync = True), 'd': lambda tag, c: actions.Delay (sec = float(c)) } def d3(s, *args): def f(): sc = script.Script() an = True for b in args: tag = b[0] print (tag) for c in b[1:]: if isinstance(c, tuple):