From d1235174157bd498d0c148325d7c8066e3ab6ac7 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 15 Feb 2021 12:05:18 -0500 Subject: Added camera shake to lightning event --- res/scripts/common.lua | 8 ++++++++ res/scripts/map2.lua | 11 +++++++++++ 2 files changed, 19 insertions(+) (limited to 'res') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 2197417..422d157 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -131,6 +131,14 @@ function WaitForMapFade() end end +function ShakeCamera(period) + effect():shakeCamera(period) +end + +function StopShakingCamera() + effect():stopShakingCamera() +end + function SetPartyDirection(spriteId, direction) animation():setSpriteDirection(spriteId, direction) diff --git a/res/scripts/map2.lua b/res/scripts/map2.lua index 12a5df0..cdab0f5 100644 --- a/res/scripts/map2.lua +++ b/res/scripts/map2.lua @@ -26,6 +26,15 @@ end function map2.mailbox_lightning() StartCutscene() + DisplayMessage("* The mailbox lid is open...\n* Peek inside?", "", SpeakerType.NONE) + ShowChoice("Yes", "No") + WaitForEndOfMessage() + + if GetChoiceSelection() == 1 then + HideCutsceneBars() + return + end + FadeMap(500, 0.5) WaitForMapFade() @@ -38,11 +47,13 @@ function map2.mailbox_lightning() local lucasPos = GetPosition("lucas") CreateAnimatedSpriteAtPosition("lightning_from_mailbox", "lightning", lucasPos:x() + 56, lucasPos:y() - 72, "strike", Direction.DOWN_LEFT, SpriteLayer.ABOVE) + ShakeCamera(66) PlaySound("lightning_explosion.wav") SetDirection("lucas", Direction.DOWN) SetAnimation("lucas", "lightning_electrocute!") WaitForAnimation("lucas") + StopShakingCamera() DestroyNamedSprite("lightning_from_mailbox") SetAnimation("lucas", "lightning_collapse!") WaitForAnimation("lucas") -- cgit 1.4.1