From d5e3bc615b300eb985d59b91ebd1f2f1a4d4e107 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 26 Feb 2021 16:47:24 -0500 Subject: Added first underwater map Also spruced up the event that takes you there. Also fixed an issue where transplantParty wouldn't take the medium of the new position into consideration. Also added a constructor to the lua version of vec2i. --- res/scripts/common.lua | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'res/scripts/common.lua') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index af25333..e95f6f1 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -34,6 +34,10 @@ CutsceneOptions = { DO_NOT_CHANGE_ANIMATION = 1 -- Prevents player party animation being set to "frozen" at the start of a cutscene or "still" at the end } +ChangeMapOptions = { + DO_NOT_FADE = 1 -- Prevents fading to and from black +} + gamestate = {} --- Yields until the specified amount of time has passed. @@ -129,6 +133,11 @@ function GetPosition(spriteName) return sprite.loc end +function SetPosition(spriteName, x, y) + local spriteId = getSpriteByAlias(spriteName) + transform():moveSprite(spriteId, vec2i.new(x, y)) +end + function SetDirection(spriteName, dir) local spriteId = getSpriteByAlias(spriteName) animation():setSpriteDirection(spriteId, dir) @@ -239,18 +248,24 @@ function SetPartyAnimation(spriteId, animName) end end -function ChangeMap(map, warp) +function ChangeMap(map, warp, options) + options = options or 0 + local playerId = getPlayerSprite() local playerSprite = getSprite(playerId) local direction = playerSprite.dir playerSprite.controllable = false - FadeToBlack(150) + if (options & ChangeMapOptions.DO_NOT_FADE == 0) then + FadeToBlack(150) + end loadMap(map) character():transplantParty(playerId, getWarpPoint(warp), direction) coroutine.yield() - RemoveFadeout(150) + if (options & ChangeMapOptions.DO_NOT_FADE == 0) then + RemoveFadeout(150) + end playerSprite.controllable = true end -- cgit 1.4.1