diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-14 16:13:08 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-14 16:13:08 -0500 |
commit | ce0628c5ad96e094db12a67d4e98b445fa873ad3 (patch) | |
tree | 94a67903059685969085f7ee5724b9960c74d3f6 /res | |
parent | 73c9b0fb4eb35e73d0005f896462e748a207d2b1 (diff) | |
download | tanetane-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')
-rw-r--r-- | res/scripts/common.lua | 29 | ||||
-rw-r--r-- | res/scripts/map2.lua | 6 |
2 files changed, 24 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() | ||
44 | end | 45 | end |
45 | 46 | ||
46 | function DisplayMessage(msg, name, type) | 47 | function DisplayMessage(msg, name, type) |
@@ -107,21 +108,27 @@ function StopSound(soundId) | |||
107 | end | 108 | end |
108 | 109 | ||
109 | function FadeToBlack(length) | 110 | function 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) | ||
116 | end | 115 | end |
117 | 116 | ||
118 | function RemoveFadeout(length) | 117 | function 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() |
122 | end | ||
123 | |||
124 | function FadeMap(length, amount) | ||
125 | effect():fadeMap(length, amount) | ||
126 | end | ||
127 | |||
128 | function WaitForMapFade() | ||
129 | while not effect():isMapFadeComplete() do | ||
130 | coroutine.yield() | ||
123 | end | 131 | end |
124 | setFadeoutProgress(0.0) | ||
125 | end | 132 | end |
126 | 133 | ||
127 | function SetPartyDirection(spriteId, direction) | 134 | function SetPartyDirection(spriteId, direction) |
diff --git a/res/scripts/map2.lua b/res/scripts/map2.lua index 8058aa2..12a5df0 100644 --- a/res/scripts/map2.lua +++ b/res/scripts/map2.lua | |||
@@ -26,6 +26,9 @@ end | |||
26 | 26 | ||
27 | function map2.mailbox_lightning() | 27 | function map2.mailbox_lightning() |
28 | StartCutscene() | 28 | StartCutscene() |
29 | FadeMap(500, 0.5) | ||
30 | WaitForMapFade() | ||
31 | |||
29 | DisplayMessage("* ...?", "", SpeakerType.NONE) | 32 | DisplayMessage("* ...?", "", SpeakerType.NONE) |
30 | WaitForEndOfMessage() | 33 | WaitForEndOfMessage() |
31 | 34 | ||
@@ -44,6 +47,9 @@ function map2.mailbox_lightning() | |||
44 | SetAnimation("lucas", "lightning_collapse!") | 47 | SetAnimation("lucas", "lightning_collapse!") |
45 | WaitForAnimation("lucas") | 48 | WaitForAnimation("lucas") |
46 | 49 | ||
50 | FadeMap(500, 0.0) | ||
51 | WaitForMapFade() | ||
52 | |||
47 | DisplayMessage("* It was lightning.\n\fAh.", "", SpeakerType.NONE) | 53 | DisplayMessage("* It was lightning.\n\fAh.", "", SpeakerType.NONE) |
48 | WaitForEndOfMessage() | 54 | WaitForEndOfMessage() |
49 | HideCutsceneBars() | 55 | HideCutsceneBars() |