diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 18:12:15 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 18:12:15 -0500 |
commit | 312a3738359cc4841cb3ce675583094becd8e830 (patch) | |
tree | 7028d5fa8fdc0f98653e4638452daeaa4120ce41 /res/scripts | |
parent | ee7077c7ff0c22a4909c15ab34aed777b45b977e (diff) | |
download | tanetane-312a3738359cc4841cb3ce675583094becd8e830.tar.gz tanetane-312a3738359cc4841cb3ce675583094becd8e830.tar.bz2 tanetane-312a3738359cc4841cb3ce675583094becd8e830.zip |
Running is preserved across screen transitions
Diffstat (limited to 'res/scripts')
-rw-r--r-- | res/scripts/common.lua | 13 |
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 | ||
21 | CharacterState = { | ||
22 | STILL = 0, | ||
23 | WALKING = 1, | ||
24 | CROUCHING = 2, | ||
25 | RUNNING = 3 | ||
26 | } | ||
27 | |||
21 | function DisplayMessage(msg, name, type) | 28 | function DisplayMessage(msg, name, type) |
22 | message():displayMessage(msg, name, type) | 29 | message():displayMessage(msg, name, type) |
23 | end | 30 | end |
@@ -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) |
93 | end | 106 | end |