summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-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