From a645524d19bb9183d4eece72bf8945bba4bed3a0 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 16 Feb 2021 22:03:10 -0500 Subject: Added scriptable camera panning --- res/scripts/common.lua | 23 +++++++++++++++++++++++ res/scripts/map2.lua | 19 ++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) (limited to 'res') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index caab86a..f88c4c1 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -141,6 +141,29 @@ function StopShakingCamera() effect():stopShakingCamera() end +function PanToSprite(spriteName, length) + local spriteId = getSpriteByAlias(spriteName) + camera():panToSprite(spriteId, length) +end + +function WaitForPan() + while camera():isPanning() do + coroutine.yield() + end +end + +function ReturnCamera(length) + local playerId = getPlayerSprite() + camera():panToSprite(playerId, length) + + while camera():isPanning() do + coroutine.yield() + end + + camera():setFollowingSprite(playerId) + camera():unlockCamera() +end + function SetPartyDirection(spriteId, direction) animation():setSpriteDirection(spriteId, direction) diff --git a/res/scripts/map2.lua b/res/scripts/map2.lua index 92c1747..c929e8d 100644 --- a/res/scripts/map2.lua +++ b/res/scripts/map2.lua @@ -74,9 +74,26 @@ function map2.approach_doria() gamestate.approached_doria = true StartCutscene() + PanToSprite("doria", 2000) + WaitForPan() + SetDirection("doria", Direction.DOWN_RIGHT) SetAnimation("doria", "talk") - DisplayMessage("* Oh my!\n* Is that our little Kumatora I spy? `\n* Such style! Such swagger!\nWhy, just as if she were Magifolk herself! `\n* When Ionia showed us the human she was looking after, I hardly knew what to think.", "Doria", SpeakerType.MAN) + DisplayMessage("* Oh my!\n\f* Is that our little Kumatora I spy? `", "Doria", SpeakerType.MAN) + WaitForEndOfMessage() + + SetAnimation("doria", "still") + ReturnCamera(2000) + Delay(1000) + SetAnimation("kuma", "talk") + DisplayMessage("* Doria...?\n\f* What the hell... You're still alive?", "Kumatora", SpeakerType.WOMAN) + WaitForEndOfMessage() + + SetAnimation("kuma", "still") + Delay(1000) + + SetAnimation("doria", "talk") + DisplayMessage("* It is! It is her!\n\f* Such style! Such swagger!\nWhy, just as if she were Magifolk herself! `\n* When Ionia showed us the human she was looking after, I hardly knew what to think.", "Doria", SpeakerType.MAN) WaitForEndOfMessage() SetDirection("doria", Direction.DOWN) -- cgit 1.4.1