diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 19:57:23 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 19:57:23 -0500 |
commit | 05ee221cd31a782b699cc6d62e0d275364cfd7cc (patch) | |
tree | 4ee6c769fd65ae38edc117f02e98455b43bfd677 /res/scripts | |
parent | 213203fbe3352e084c8875acfbf435a948824c08 (diff) | |
download | tanetane-05ee221cd31a782b699cc6d62e0d275364cfd7cc.tar.gz tanetane-05ee221cd31a782b699cc6d62e0d275364cfd7cc.tar.bz2 tanetane-05ee221cd31a782b699cc6d62e0d275364cfd7cc.zip |
Player is no longer controllable during map transitions
Diffstat (limited to 'res/scripts')
-rw-r--r-- | res/scripts/common.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 23c07cc..1841662 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua | |||
@@ -86,19 +86,22 @@ function SetPartyDirection(spriteId, direction) | |||
86 | end | 86 | end |
87 | 87 | ||
88 | function ChangeMap(map, warp) | 88 | function ChangeMap(map, warp) |
89 | local playerId = getControllableSprite() | 89 | local playerId = getPlayerSprite() |
90 | local playerSprite = getSprite(playerId) | 90 | local playerSprite = getSprite(playerId) |
91 | local direction = playerSprite.dir | 91 | local direction = playerSprite.dir |
92 | local oldState = playerSprite.characterState | 92 | local oldState = playerSprite.characterState |
93 | 93 | ||
94 | playerSprite.controllable = false | ||
94 | FadeToBlack(150) | 95 | FadeToBlack(150) |
95 | loadMap("../res/maps/" .. map .. ".tmx", warp, direction) | 96 | loadMap("../res/maps/" .. map .. ".tmx", warp, direction) |
96 | 97 | ||
97 | local newPlayerId = getControllableSprite() | 98 | local newPlayerId = getPlayerSprite() |
99 | local newPlayerSprite = getSprite(newPlayerId) | ||
98 | if oldState == CharacterState.RUNNING then | 100 | if oldState == CharacterState.RUNNING then |
99 | character():startRunning(newPlayerId) | 101 | character():startRunning(newPlayerId) |
100 | end | 102 | end |
101 | 103 | ||
102 | coroutine.yield() | 104 | coroutine.yield() |
103 | RemoveFadeout(150) | 105 | RemoveFadeout(150) |
106 | newPlayerSprite.controllable = true | ||
104 | end | 107 | end |