diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-26 16:47:24 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-26 16:47:24 -0500 |
commit | d5e3bc615b300eb985d59b91ebd1f2f1a4d4e107 (patch) | |
tree | 7356a6796ff166a85b8f7accb20e82596f200a63 /res/scripts/common.lua | |
parent | 46bf85e7b85b8d3e61f0d2b276450c4f439b5c30 (diff) | |
download | tanetane-d5e3bc615b300eb985d59b91ebd1f2f1a4d4e107.tar.gz tanetane-d5e3bc615b300eb985d59b91ebd1f2f1a4d4e107.tar.bz2 tanetane-d5e3bc615b300eb985d59b91ebd1f2f1a4d4e107.zip |
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.
Diffstat (limited to 'res/scripts/common.lua')
-rw-r--r-- | res/scripts/common.lua | 21 |
1 files changed, 18 insertions, 3 deletions
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 = { | |||
34 | DO_NOT_CHANGE_ANIMATION = 1 -- Prevents player party animation being set to "frozen" at the start of a cutscene or "still" at the end | 34 | DO_NOT_CHANGE_ANIMATION = 1 -- Prevents player party animation being set to "frozen" at the start of a cutscene or "still" at the end |
35 | } | 35 | } |
36 | 36 | ||
37 | ChangeMapOptions = { | ||
38 | DO_NOT_FADE = 1 -- Prevents fading to and from black | ||
39 | } | ||
40 | |||
37 | gamestate = {} | 41 | gamestate = {} |
38 | 42 | ||
39 | --- Yields until the specified amount of time has passed. | 43 | --- Yields until the specified amount of time has passed. |
@@ -129,6 +133,11 @@ function GetPosition(spriteName) | |||
129 | return sprite.loc | 133 | return sprite.loc |
130 | end | 134 | end |
131 | 135 | ||
136 | function SetPosition(spriteName, x, y) | ||
137 | local spriteId = getSpriteByAlias(spriteName) | ||
138 | transform():moveSprite(spriteId, vec2i.new(x, y)) | ||
139 | end | ||
140 | |||
132 | function SetDirection(spriteName, dir) | 141 | function SetDirection(spriteName, dir) |
133 | local spriteId = getSpriteByAlias(spriteName) | 142 | local spriteId = getSpriteByAlias(spriteName) |
134 | animation():setSpriteDirection(spriteId, dir) | 143 | animation():setSpriteDirection(spriteId, dir) |
@@ -239,18 +248,24 @@ function SetPartyAnimation(spriteId, animName) | |||
239 | end | 248 | end |
240 | end | 249 | end |
241 | 250 | ||
242 | function ChangeMap(map, warp) | 251 | function ChangeMap(map, warp, options) |
252 | options = options or 0 | ||
253 | |||
243 | local playerId = getPlayerSprite() | 254 | local playerId = getPlayerSprite() |
244 | local playerSprite = getSprite(playerId) | 255 | local playerSprite = getSprite(playerId) |
245 | local direction = playerSprite.dir | 256 | local direction = playerSprite.dir |
246 | 257 | ||
247 | playerSprite.controllable = false | 258 | playerSprite.controllable = false |
248 | FadeToBlack(150) | 259 | if (options & ChangeMapOptions.DO_NOT_FADE == 0) then |
260 | FadeToBlack(150) | ||
261 | end | ||
249 | loadMap(map) | 262 | loadMap(map) |
250 | character():transplantParty(playerId, getWarpPoint(warp), direction) | 263 | character():transplantParty(playerId, getWarpPoint(warp), direction) |
251 | 264 | ||
252 | coroutine.yield() | 265 | coroutine.yield() |
253 | RemoveFadeout(150) | 266 | if (options & ChangeMapOptions.DO_NOT_FADE == 0) then |
267 | RemoveFadeout(150) | ||
268 | end | ||
254 | playerSprite.controllable = true | 269 | playerSprite.controllable = true |
255 | end | 270 | end |
256 | 271 | ||