summary refs log tree commit diff stats
path: root/res/scripts/common.lua
diff options
context:
space:
mode:
Diffstat (limited to 'res/scripts/common.lua')
-rw-r--r--res/scripts/common.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 3c412c6..3db1b26 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua
@@ -59,11 +59,24 @@ function HideCutsceneBars()
59 playerSprite.controllable = true 59 playerSprite.controllable = true
60end 60end
61 61
62function SetDirection(spriteName, dir)
63 local spriteId = getSpriteByAlias(spriteName)
64 animation():setSpriteDirection(spriteId, dir)
65end
66
62function SetAnimation(spriteName, animName) 67function SetAnimation(spriteName, animName)
63 local spriteId = getSpriteByAlias(spriteName) 68 local spriteId = getSpriteByAlias(spriteName)
64 animation():setSpriteAnimation(spriteId, animName) 69 animation():setSpriteAnimation(spriteId, animName)
65end 70end
66 71
72function WaitForAnimation(spriteName)
73 local spriteId = getSpriteByAlias(spriteName)
74 local sprite = getSprite(spriteId)
75 repeat
76 coroutine.yield()
77 until sprite.animFinished
78end
79
67function PlaySound(filename) 80function PlaySound(filename)
68 mixer():playSound("../res/sfx/" .. filename) 81 mixer():playSound("../res/sfx/" .. filename)
69end 82end