diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 18:06:35 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 18:06:35 -0500 |
commit | ee7077c7ff0c22a4909c15ab34aed777b45b977e (patch) | |
tree | 9541d62461579c752afd0c1af4794acb1c23d10c /res | |
parent | 2afa279d4c7780e4d43749d73891c9a7d46f4472 (diff) | |
download | tanetane-ee7077c7ff0c22a4909c15ab34aed777b45b977e.tar.gz tanetane-ee7077c7ff0c22a4909c15ab34aed777b45b977e.tar.bz2 tanetane-ee7077c7ff0c22a4909c15ab34aed777b45b977e.zip |
Direction is preserved across map transitions now
Diffstat (limited to 'res')
-rw-r--r-- | res/scripts/common.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index f43b2e0..0c0205b 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua | |||
@@ -7,6 +7,17 @@ SpeakerType = { | |||
7 | NONHUMAN = 5 | 7 | NONHUMAN = 5 |
8 | } | 8 | } |
9 | 9 | ||
10 | Direction = { | ||
11 | UP = 0, | ||
12 | UP_RIGHT = 1, | ||
13 | RIGHT = 2, | ||
14 | DOWN_RIGHT = 3, | ||
15 | DOWN = 4, | ||
16 | DOWN_LEFT = 5, | ||
17 | LEFT = 6, | ||
18 | UP_LEFT = 7 | ||
19 | } | ||
20 | |||
10 | function DisplayMessage(msg, name, type) | 21 | function DisplayMessage(msg, name, type) |
11 | message():displayMessage(msg, name, type) | 22 | message():displayMessage(msg, name, type) |
12 | end | 23 | end |
@@ -57,9 +68,26 @@ function RemoveFadeout(length) | |||
57 | setFadeoutProgress(0.0) | 68 | setFadeoutProgress(0.0) |
58 | end | 69 | end |
59 | 70 | ||
71 | function SetPartyDirection(spriteId, direction) | ||
72 | animation():setSpriteDirection(spriteId, direction) | ||
73 | |||
74 | local sprite = getSprite(spriteId) | ||
75 | |||
76 | for i=1,#sprite.followers do | ||
77 | animation():setSpriteDirection(sprite.followers[i], direction) | ||
78 | end | ||
79 | end | ||
80 | |||
60 | function ChangeMap(map, warp) | 81 | function ChangeMap(map, warp) |
82 | local playerId = getControllableSprite() | ||
83 | local playerSprite = getSprite(playerId) | ||
84 | local direction = playerSprite.dir | ||
85 | |||
61 | FadeToBlack(150) | 86 | FadeToBlack(150) |
62 | loadMap("../res/maps/" .. map .. ".tmx", warp) | 87 | loadMap("../res/maps/" .. map .. ".tmx", warp) |
88 | |||
89 | local newPlayerId = getControllableSprite() | ||
90 | SetPartyDirection(newPlayerId, direction) | ||
63 | coroutine.yield() | 91 | coroutine.yield() |
64 | RemoveFadeout(150) | 92 | RemoveFadeout(150) |
65 | end | 93 | end |