From c304defdd7b0c5a8bea83f2540c009ededd450cb Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 26 Feb 2021 19:08:49 -0500 Subject: Added animation slowdown effect (for Lucas underwater) --- res/scripts/common.lua | 9 +++++++++ res/scripts/underwater.lua | 1 + res/scripts/underwater_start.lua | 1 + 3 files changed, 11 insertions(+) (limited to 'res') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 825d2e5..2a51419 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -344,3 +344,12 @@ function StopBobbing(spriteName) local sprite = getSprite(spriteId) sprite.bobsWhenNormal = false end + +--- Sets the animation slowdown for a sprite. +-- @param spriteName the alias of the sprite to modify +-- @param amount the number of animation frames needed to advance the sprite's animation (1 means the effect is disabled) +function SetAnimationSlowdown(spriteName, amount) + local spriteId = getSpriteByAlias(spriteName) + local sprite = getSprite(spriteId) + sprite.animSlowdown = amount +end diff --git a/res/scripts/underwater.lua b/res/scripts/underwater.lua index 3500079..8e1ae1a 100644 --- a/res/scripts/underwater.lua +++ b/res/scripts/underwater.lua @@ -3,6 +3,7 @@ underwater = {} function underwater.leave() AllowCrouching() StopBobbing("lucas") + SetAnimationSlowdown("lucas", 1) end function underwater.fish2() diff --git a/res/scripts/underwater_start.lua b/res/scripts/underwater_start.lua index c14f4b8..0852885 100644 --- a/res/scripts/underwater_start.lua +++ b/res/scripts/underwater_start.lua @@ -3,6 +3,7 @@ underwater_start = {} function underwater_start.init() PreventCrouching() StartBobbing("lucas") + SetAnimationSlowdown("lucas", 2) end function underwater_start.talk_to_fish1() -- cgit 1.4.1