summary refs log tree commit diff stats
path: root/res/scripts
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-10 18:06:35 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-10 18:06:35 -0500
commitee7077c7ff0c22a4909c15ab34aed777b45b977e (patch)
tree9541d62461579c752afd0c1af4794acb1c23d10c /res/scripts
parent2afa279d4c7780e4d43749d73891c9a7d46f4472 (diff)
downloadtanetane-ee7077c7ff0c22a4909c15ab34aed777b45b977e.tar.gz
tanetane-ee7077c7ff0c22a4909c15ab34aed777b45b977e.tar.bz2
tanetane-ee7077c7ff0c22a4909c15ab34aed777b45b977e.zip
Direction is preserved across map transitions now
Diffstat (limited to 'res/scripts')
-rw-r--r--res/scripts/common.lua28
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
10Direction = {
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
10function DisplayMessage(msg, name, type) 21function DisplayMessage(msg, name, type)
11 message():displayMessage(msg, name, type) 22 message():displayMessage(msg, name, type)
12end 23end
@@ -57,9 +68,26 @@ function RemoveFadeout(length)
57 setFadeoutProgress(0.0) 68 setFadeoutProgress(0.0)
58end 69end
59 70
71function 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
79end
80
60function ChangeMap(map, warp) 81function 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)
65end 93end