summary refs log tree commit diff stats
path: root/res/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'res/scripts')
-rw-r--r--res/scripts/common.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 0c0205b..9674b2c 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua
@@ -18,6 +18,13 @@ Direction = {
18 UP_LEFT = 7 18 UP_LEFT = 7
19} 19}
20 20
21CharacterState = {
22 STILL = 0,
23 WALKING = 1,
24 CROUCHING = 2,
25 RUNNING = 3
26}
27
21function DisplayMessage(msg, name, type) 28function DisplayMessage(msg, name, type)
22 message():displayMessage(msg, name, type) 29 message():displayMessage(msg, name, type)
23end 30end
@@ -82,12 +89,18 @@ function ChangeMap(map, warp)
82 local playerId = getControllableSprite() 89 local playerId = getControllableSprite()
83 local playerSprite = getSprite(playerId) 90 local playerSprite = getSprite(playerId)
84 local direction = playerSprite.dir 91 local direction = playerSprite.dir
92 local oldState = playerSprite.characterState
85 93
86 FadeToBlack(150) 94 FadeToBlack(150)
87 loadMap("../res/maps/" .. map .. ".tmx", warp) 95 loadMap("../res/maps/" .. map .. ".tmx", warp)
88 96
89 local newPlayerId = getControllableSprite() 97 local newPlayerId = getControllableSprite()
90 SetPartyDirection(newPlayerId, direction) 98 SetPartyDirection(newPlayerId, direction)
99
100 if oldState == CharacterState.RUNNING then
101 character():startRunning(newPlayerId)
102 end
103
91 coroutine.yield() 104 coroutine.yield()
92 RemoveFadeout(150) 105 RemoveFadeout(150)
93end 106end