From 0e1e97da9e8937d19b0101dcc1f3a16e3db495b6 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 6 Feb 2021 21:15:34 -0500 Subject: Added sound and animation changes to scripting --- res/scripts/common.lua | 17 +++++++++++++++++ res/scripts/script0001.lua | 10 +++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'res/scripts') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 7e8276f..e7af1cf 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -21,3 +21,20 @@ function HideCutsceneBars() WaitForEndOfMessage() message():hideCutsceneBars() end + +function SetAnimation(spriteName, animName) + local spriteId = getSpriteByAlias(spriteName) + animation():setSpriteAnimation(spriteId, animName) +end + +function PlaySound(filename) + mixer():playSound("../res/sfx/" .. filename) +end + +function LoopSound(filename) + return mixer():loopSound("../res/sfx/" .. filename) +end + +function StopSound(soundId) + mixer():stopChannel(soundId) +end diff --git a/res/scripts/script0001.lua b/res/scripts/script0001.lua index 3a09705..326b37c 100644 --- a/res/scripts/script0001.lua +++ b/res/scripts/script0001.lua @@ -1,4 +1,12 @@ function script0001() - DisplayMessage("It's almost suppertime.\nHinawa should be back soon.\nWhat? She's not coming back? Why, did you do something to her?\nHuh? I did it to her? Hinawa isn't coming back?\nWho are you? What did you do?\nIt's time for supper. It's time for supper.", "Flint", SpeakerType.MAN) + SetAnimation("boney", "barking") + local barkingNoise = LoopSound("barking_at_hallucination.wav") + + DisplayMessage("Lucas. It's me, Flint. Your father.\nI found Claus. He's here. After three years I've finally found your brother.\nLook at me when I'm talking to you, Lucas.\nWhen Claus gets home, we won't need you anymore. You're nothing compared to him.", "Flint", SpeakerType.MAN) + WaitForEndOfMessage() + + SetAnimation("boney", "crouch") + StopSound(barkingNoise) + PlaySound("boney_growl.wav") HideCutsceneBars() end -- cgit 1.4.1