summary refs log tree commit diff stats
path: root/res/scripts/common.lua
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-14 16:13:08 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-14 16:13:08 -0500
commitce0628c5ad96e094db12a67d4e98b445fa873ad3 (patch)
tree94a67903059685969085f7ee5724b9960c74d3f6 /res/scripts/common.lua
parent73c9b0fb4eb35e73d0005f896462e748a207d2b1 (diff)
downloadtanetane-ce0628c5ad96e094db12a67d4e98b445fa873ad3.tar.gz
tanetane-ce0628c5ad96e094db12a67d4e98b445fa873ad3.tar.bz2
tanetane-ce0628c5ad96e094db12a67d4e98b445fa873ad3.zip
Added map fadeouts
Screen fadeouts and map fadeouts are now handled by the effect system.
Diffstat (limited to 'res/scripts/common.lua')
-rw-r--r--res/scripts/common.lua29
1 files changed, 18 insertions, 11 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 75b86a8..2197417 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua
@@ -41,6 +41,7 @@ function StartCutscene()
41 local playerSprite = getSprite(playerId) 41 local playerSprite = getSprite(playerId)
42 playerSprite.controllable = false 42 playerSprite.controllable = false
43 character():halt(playerId) 43 character():halt(playerId)
44 message():displayCutsceneBars()
44end 45end
45 46
46function DisplayMessage(msg, name, type) 47function DisplayMessage(msg, name, type)
@@ -107,21 +108,27 @@ function StopSound(soundId)
107end 108end
108 109
109function FadeToBlack(length) 110function FadeToBlack(length)
110 local progress = 0.0 111 effect():fadeScreen(length, 1.0)
111 while progress < length do 112 repeat
112 progress = progress + coroutine.yield() 113 coroutine.yield()
113 setFadeoutProgress(progress / length) 114 until effect():isScreenFadeComplete()
114 end
115 setFadeoutProgress(1.0)
116end 115end
117 116
118function RemoveFadeout(length) 117function RemoveFadeout(length)
119 local progress = length 118 effect():fadeScreen(length, 0.0)
120 while progress > 0 do 119 repeat
121 progress = progress - coroutine.yield() 120 coroutine.yield()
122 setFadeoutProgress(progress / length) 121 until effect():isScreenFadeComplete()
122end
123
124function FadeMap(length, amount)
125 effect():fadeMap(length, amount)
126end
127
128function WaitForMapFade()
129 while not effect():isMapFadeComplete() do
130 coroutine.yield()
123 end 131 end
124 setFadeoutProgress(0.0)
125end 132end
126 133
127function SetPartyDirection(spriteId, direction) 134function SetPartyDirection(spriteId, direction)