From ed933607765a6e010689aaaf85184053ff6e8a2b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Feb 2021 12:14:58 -0500 Subject: Added non-looping animations Lucas can get electrocuted now. --- res/scripts/common.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'res/scripts/common.lua') 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() playerSprite.controllable = true end +function SetDirection(spriteName, dir) + local spriteId = getSpriteByAlias(spriteName) + animation():setSpriteDirection(spriteId, dir) +end + function SetAnimation(spriteName, animName) local spriteId = getSpriteByAlias(spriteName) animation():setSpriteAnimation(spriteId, animName) end +function WaitForAnimation(spriteName) + local spriteId = getSpriteByAlias(spriteName) + local sprite = getSprite(spriteId) + repeat + coroutine.yield() + until sprite.animFinished +end + function PlaySound(filename) mixer():playSound("../res/sfx/" .. filename) end -- cgit 1.4.1