diff options
Diffstat (limited to 'res')
-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 |