diff options
-rw-r--r-- | res/maps/hallucination_cliff.tmx | 25 | ||||
-rw-r--r-- | res/scripts/hallucination_cliff.lua | 84 | ||||
-rw-r--r-- | src/main.cpp | 4 |
3 files changed, 110 insertions, 3 deletions
diff --git a/res/maps/hallucination_cliff.tmx b/res/maps/hallucination_cliff.tmx index 817f2ad..0e09ecd 100644 --- a/res/maps/hallucination_cliff.tmx +++ b/res/maps/hallucination_cliff.tmx | |||
@@ -1,5 +1,5 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="48" height="48" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="13"> | 2 | <map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="48" height="48" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="18"> |
3 | <properties> | 3 | <properties> |
4 | <property name="music" value="red_green_yellow_yellow"/> | 4 | <property name="music" value="red_green_yellow_yellow"/> |
5 | </properties> | 5 | </properties> |
@@ -159,6 +159,29 @@ | |||
159 | </properties> | 159 | </properties> |
160 | <point/> | 160 | <point/> |
161 | </object> | 161 | </object> |
162 | <object id="13" name="see_hinawa_first_event" type="trigger" x="560" y="528" width="16" height="16"> | ||
163 | <properties> | ||
164 | <property name="script" value="see_hinawa_first_event"/> | ||
165 | </properties> | ||
166 | </object> | ||
167 | <object id="14" name="first_hinawa_vantage" type="warp" x="568" y="488"> | ||
168 | <point/> | ||
169 | </object> | ||
170 | <object id="15" name="hinawa" type="sprite" x="568" y="456"> | ||
171 | <properties> | ||
172 | <property name="animation" value="ghost_hinawa"/> | ||
173 | <property name="direction" value="left"/> | ||
174 | <property name="floating" type="bool" value="true"/> | ||
175 | <property name="movementSpeed" type="int" value="1"/> | ||
176 | </properties> | ||
177 | <point/> | ||
178 | </object> | ||
179 | <object id="16" name="hinawa_second_position" type="warp" x="456" y="288"> | ||
180 | <point/> | ||
181 | </object> | ||
182 | <object id="17" name="hinawa_offscreen_first" type="warp" x="432" y="456"> | ||
183 | <point/> | ||
184 | </object> | ||
162 | </objectgroup> | 185 | </objectgroup> |
163 | <layer id="1" name="Upper" width="48" height="48"> | 186 | <layer id="1" name="Upper" width="48" height="48"> |
164 | <properties> | 187 | <properties> |
diff --git a/res/scripts/hallucination_cliff.lua b/res/scripts/hallucination_cliff.lua index 020a743..d539e62 100644 --- a/res/scripts/hallucination_cliff.lua +++ b/res/scripts/hallucination_cliff.lua | |||
@@ -1,5 +1,35 @@ | |||
1 | hallucination_cliff = {} | 1 | hallucination_cliff = {} |
2 | 2 | ||
3 | function hallucination_cliff.init() | ||
4 | gamestate.hinawa_can_appear = false | ||
5 | if gamestate.saw_hinawa_first_scene then | ||
6 | if gamestate.saw_hinawa_second_scene then | ||
7 | -- the event can no longer trigger if the player leaves the map after | ||
8 | -- seeing hinawa a second time. | ||
9 | else | ||
10 | -- as long as nothing else prevents the scene from occuring, a player | ||
11 | -- who interrupted the hinawa event by leaving the map before seeing her | ||
12 | -- a second time is allowed to resume the event. | ||
13 | gamestate.hinawa_can_appear = true | ||
14 | MoveSpriteToWarp("hinawa", "hinawa_second_position") | ||
15 | end | ||
16 | else | ||
17 | -- the hinawa event only has a 50% chance of triggering; reloading the map | ||
18 | -- rolls this again. | ||
19 | if randomChance(1.0/2.0) then | ||
20 | gamestate.hinawa_can_appear = true | ||
21 | end | ||
22 | end | ||
23 | -- the hinawa event will not occur if claus ever joined the party. | ||
24 | if gamestate.claus_joined then | ||
25 | gamestate.hinawa_can_appear = false | ||
26 | end | ||
27 | -- if hinawa can't appear, remove her from the map. | ||
28 | if not gamestate.hinawa_can_appear then | ||
29 | DestroyNamedSprite("hinawa") | ||
30 | end | ||
31 | end | ||
32 | |||
3 | function hallucination_cliff.off_bottom() | 33 | function hallucination_cliff.off_bottom() |
4 | ChangeMap("hallucination_interior", "fromTop") | 34 | ChangeMap("hallucination_interior", "fromTop") |
5 | end | 35 | end |
@@ -136,3 +166,57 @@ function hallucination_cliff.claus_fall_event() | |||
136 | -- character():addSpriteToParty(getPlayerSprite(), getSpriteByAlias("duster")) | 166 | -- character():addSpriteToParty(getPlayerSprite(), getSpriteByAlias("duster")) |
137 | -- character():addSpriteToParty(getPlayerSprite(), getSpriteByAlias("boney")) | 167 | -- character():addSpriteToParty(getPlayerSprite(), getSpriteByAlias("boney")) |
138 | end | 168 | end |
169 | |||
170 | function hallucination_cliff.see_hinawa_first_event() | ||
171 | -- for safety, check if the claus falling event is happening, since it moves | ||
172 | -- the party into this event's trigger. | ||
173 | if gamestate.claus_fall_scene then | ||
174 | return | ||
175 | end | ||
176 | |||
177 | -- the scene only triggers under certain circumstances (see the init function) | ||
178 | if not gamestate.hinawa_can_appear then | ||
179 | return | ||
180 | end | ||
181 | |||
182 | -- do not trigger a second time | ||
183 | if gamestate.saw_hinawa_first_scene then | ||
184 | return | ||
185 | end | ||
186 | |||
187 | gamestate.saw_hinawa_first_scene = true | ||
188 | |||
189 | StartCutscene(CutsceneOptions.DO_NOT_CHANGE_ANIMATION) | ||
190 | Delay(100) | ||
191 | |||
192 | ShowExpression("lucas", "surprise") | ||
193 | ShowExpression("kuma", "surprise") | ||
194 | ShowExpression("duster", "surprise") | ||
195 | Delay(1000) | ||
196 | |||
197 | PanToWarpPoint("first_hinawa_vantage", 2000) | ||
198 | Delay(750) | ||
199 | |||
200 | RemoveExpression("lucas") | ||
201 | RemoveExpression("kuma") | ||
202 | RemoveExpression("duster") | ||
203 | WaitForPan() | ||
204 | Delay(2000) | ||
205 | |||
206 | MakeSpriteNotSolid("hinawa") | ||
207 | UnpauseSprite("hinawa") | ||
208 | DirectSpriteToLocation("hinawa", "hinawa_offscreen_first", PathfindingOptions.CARDINAL_DIRECTIONS_ONLY) | ||
209 | WaitForSpritePath("hinawa") | ||
210 | |||
211 | DisableBehaviour("hinawa") | ||
212 | PauseSprite("hinawa") | ||
213 | MoveSpriteToWarp("hinawa", "hinawa_second_position") | ||
214 | Delay(2000) | ||
215 | ReturnCamera(1000) | ||
216 | Delay(500) | ||
217 | |||
218 | DisplayMessage("* Lucas... Was that...?", "Kumatora", SpeakerType.WOMAN) | ||
219 | WaitForEndOfMessage() | ||
220 | |||
221 | HideCutsceneBars(CutsceneOptions.DO_NOT_CHANGE_ANIMATION) | ||
222 | end | ||
diff --git a/src/main.cpp b/src/main.cpp index f1a8e42..2d3cb5d 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
@@ -31,9 +31,9 @@ void loop(Renderer& renderer, std::mt19937& rng) { | |||
31 | game.emplaceSystem<EffectSystem>(); | 31 | game.emplaceSystem<EffectSystem>(); |
32 | game.emplaceSystem<MenuSystem>(); | 32 | game.emplaceSystem<MenuSystem>(); |
33 | 33 | ||
34 | game.loadMap("hallucination_interior"); | 34 | game.loadMap("hallucination_cliff"); |
35 | 35 | ||
36 | vec2i warpLoc = game.getMap().getWarpPoint("debugWarp_rightside"); | 36 | vec2i warpLoc = game.getMap().getWarpPoint("fromBottom"); |
37 | 37 | ||
38 | int lucasSprite = game.emplaceSprite("lucas"); | 38 | int lucasSprite = game.emplaceSprite("lucas"); |
39 | game.getSystem<TransformSystem>().initSprite(lucasSprite, warpLoc); | 39 | game.getSystem<TransformSystem>().initSprite(lucasSprite, warpLoc); |