summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--res/maps/finale.tmx3
-rw-r--r--res/maps/forest.tsx71
-rw-r--r--res/scripts/common.lua15
-rw-r--r--res/scripts/finale.lua22
-rw-r--r--src/script_system.cpp3
5 files changed, 44 insertions, 70 deletions
diff --git a/res/maps/finale.tmx b/res/maps/finale.tmx index 5c48c97..be30d18 100644 --- a/res/maps/finale.tmx +++ b/res/maps/finale.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="32" height="16" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="6"> 2<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="32" height="16" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="7">
3 <tileset firstgid="1" source="forest.tsx"/> 3 <tileset firstgid="1" source="forest.tsx"/>
4 <layer id="2" name="Lower" width="32" height="16"> 4 <layer id="2" name="Lower" width="32" height="16">
5 <data encoding="csv"> 5 <data encoding="csv">
@@ -34,6 +34,7 @@
34 <object id="5" name="boney_start" type="warp" x="197.84" y="144"> 34 <object id="5" name="boney_start" type="warp" x="197.84" y="144">
35 <point/> 35 <point/>
36 </object> 36 </object>
37 <object id="6" name="hotspring_enclosure" type="zone" x="224" y="104" width="96" height="56"/>
37 </objectgroup> 38 </objectgroup>
38 <layer id="1" name="Upper" width="32" height="16"> 39 <layer id="1" name="Upper" width="32" height="16">
39 <properties> 40 <properties>
diff --git a/res/maps/forest.tsx b/res/maps/forest.tsx index bff44a5..633544a 100644 --- a/res/maps/forest.tsx +++ b/res/maps/forest.tsx
@@ -1,49 +1,19 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<tileset version="1.4" tiledversion="1.4.3" name="forest" tilewidth="16" tileheight="16" tilecount="80" columns="10"> 2<tileset version="1.4" tiledversion="1.4.3" name="forest" tilewidth="16" tileheight="16" tilecount="80" columns="10">
3 <image source="forest_tiles.png" width="160" height="128"/> 3 <image source="forest_tiles.png" width="160" height="128"/>
4 <tile id="6">
5 <properties>
6 <property name="solid" type="bool" value="true"/>
7 </properties>
8 </tile>
9 <tile id="7">
10 <properties>
11 <property name="solid" type="bool" value="true"/>
12 </properties>
13 </tile>
14 <tile id="8">
15 <properties>
16 <property name="solid" type="bool" value="true"/>
17 </properties>
18 </tile>
19 <tile id="9">
20 <properties>
21 <property name="solid" type="bool" value="true"/>
22 </properties>
23 </tile>
24 <tile id="10">
25 <properties>
26 <property name="solid" type="bool" value="true"/>
27 </properties>
28 </tile>
29 <tile id="11"> 4 <tile id="11">
30 <properties> 5 <properties>
31 <property name="solid" type="bool" value="true"/> 6 <property name="medium" value="water"/>
32 </properties> 7 </properties>
33 </tile> 8 </tile>
34 <tile id="12"> 9 <tile id="12">
35 <properties> 10 <properties>
36 <property name="solid" type="bool" value="true"/> 11 <property name="medium" value="water"/>
37 </properties> 12 </properties>
38 </tile> 13 </tile>
39 <tile id="13"> 14 <tile id="13">
40 <properties> 15 <properties>
41 <property name="solid" type="bool" value="true"/> 16 <property name="medium" value="water"/>
42 </properties>
43 </tile>
44 <tile id="14">
45 <properties>
46 <property name="solid" type="bool" value="true"/>
47 </properties> 17 </properties>
48 </tile> 18 </tile>
49 <tile id="15"> 19 <tile id="15">
@@ -51,44 +21,9 @@
51 <property name="medium" value="water"/> 21 <property name="medium" value="water"/>
52 </properties> 22 </properties>
53 </tile> 23 </tile>
54 <tile id="16">
55 <properties>
56 <property name="solid" type="bool" value="true"/>
57 </properties>
58 </tile>
59 <tile id="18">
60 <properties>
61 <property name="solid" type="bool" value="true"/>
62 </properties>
63 </tile>
64 <tile id="19"> 24 <tile id="19">
65 <properties> 25 <properties>
66 <property name="medium" value="water"/> 26 <property name="medium" value="water"/>
67 </properties> 27 </properties>
68 </tile> 28 </tile>
69 <tile id="22">
70 <properties>
71 <property name="solid" type="bool" value="true"/>
72 </properties>
73 </tile>
74 <tile id="23">
75 <properties>
76 <property name="solid" type="bool" value="true"/>
77 </properties>
78 </tile>
79 <tile id="24">
80 <properties>
81 <property name="solid" type="bool" value="true"/>
82 </properties>
83 </tile>
84 <tile id="25">
85 <properties>
86 <property name="solid" type="bool" value="true"/>
87 </properties>
88 </tile>
89 <tile id="26">
90 <properties>
91 <property name="solid" type="bool" value="true"/>
92 </properties>
93 </tile>
94</tileset> 29</tileset>
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index dbc021c..1d4879f 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua
@@ -414,6 +414,14 @@ function SetAnimationSlowdown(spriteName, amount)
414 sprite.animSlowdown = amount 414 sprite.animSlowdown = amount
415end 415end
416 416
417--- Sets the enclosure zone for a sprite.
418-- The sprite will be prevented from exiting the area defined by that zone.
419function AddEnclosureZone(spriteName, zone)
420 local spriteId = getSpriteByAlias(spriteName)
421 local sprite = getSprite(spriteId)
422 sprite.enclosureZone = zone
423end
424
417--- Removes the enclosure zone for the specified sprite. 425--- Removes the enclosure zone for the specified sprite.
418-- This allows the sprite to move outside of the confines of the zone. 426-- This allows the sprite to move outside of the confines of the zone.
419function RemoveEnclosureZone(spriteName) 427function RemoveEnclosureZone(spriteName)
@@ -607,3 +615,10 @@ function IsSpriteInZone(spriteName, zoneName)
607 615
608 return (pos:x() >= zone.ul:x()) and (pos:x() <= zone.dr:x()) and (pos:y() >= zone.ul:y()) and (pos:y() <= zone.dr:y()) 616 return (pos:x() >= zone.ul:x()) and (pos:x() <= zone.dr:x()) and (pos:y() >= zone.ul:y()) and (pos:y() <= zone.dr:y())
609end 617end
618
619--- Sets the name of the script on the current map that will be executed when the player interacts with this sprite.
620function SetInteractionScript(spriteName, scriptName)
621 local spriteId = getSpriteByAlias(spriteName)
622 local sprite = getSprite(spriteId)
623 sprite.interactionScript = scriptName
624end
diff --git a/res/scripts/finale.lua b/res/scripts/finale.lua index 2493473..7e23336 100644 --- a/res/scripts/finale.lua +++ b/res/scripts/finale.lua
@@ -3,15 +3,37 @@ finale = {}
3function finale.init() 3function finale.init()
4 character():breakUpParty(getPlayerSprite()) 4 character():breakUpParty(getPlayerSprite())
5 5
6 AddEnclosureZone("lucas", "hotspring_enclosure")
7
6 MoveSpriteToWarp("kuma", "kumatora_start") 8 MoveSpriteToWarp("kuma", "kumatora_start")
7 SetDirection("kuma", Direction.UP) 9 SetDirection("kuma", Direction.UP)
8 SetAnimation("kuma", "swim_still") 10 SetAnimation("kuma", "swim_still")
11 MakeSpriteSolid("kuma")
12 SetInteractionScript("kuma", "talk_to_kuma")
9 13
10 MoveSpriteToWarp("duster", "duster_start") 14 MoveSpriteToWarp("duster", "duster_start")
11 SetDirection("duster", Direction.RIGHT) 15 SetDirection("duster", Direction.RIGHT)
12 SetAnimation("duster", "swim_still") 16 SetAnimation("duster", "swim_still")
17 MakeSpriteSolid("duster")
18 SetInteractionScript("duster", "talk_to_duster")
13 19
14 MoveSpriteToWarp("boney", "boney_start") 20 MoveSpriteToWarp("boney", "boney_start")
15 SetDirection("boney", Direction.DOWN) 21 SetDirection("boney", Direction.DOWN)
16 SetAnimation("boney", "asleep") 22 SetAnimation("boney", "asleep")
17end 23end
24
25function finale.talk_to_kuma()
26 SetDirection("kuma", Direction.UP)
27 StartCutscene()
28 DisplayMessage("* Kumatora doesn't respond.\n\f* She is grumbling to herself, and picking at the grass growing over the wall.", "", SpeakerType.NONE)
29 WaitForEndOfMessage()
30 HideCutsceneBars()
31end
32
33function finale.talk_to_duster()
34 SetDirection("duster", Direction.RIGHT)
35 StartCutscene()
36 DisplayMessage("* Duster doesn't respond.\n\f* He is simply staring at his own reflection in the water.", "", SpeakerType.NONE)
37 WaitForEndOfMessage()
38 HideCutsceneBars()
39end
diff --git a/src/script_system.cpp b/src/script_system.cpp index 505957b..b993938 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp
@@ -54,7 +54,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
54 "movementSpeed", &Sprite::movementSpeed, 54 "movementSpeed", &Sprite::movementSpeed,
55 "solid", &Sprite::solid, 55 "solid", &Sprite::solid,
56 "behaviourType", &Sprite::behaviourType, 56 "behaviourType", &Sprite::behaviourType,
57 "followSpriteId", &Sprite::followSpriteId); 57 "followSpriteId", &Sprite::followSpriteId,
58 "interactionScript", &Sprite::interactionScript);
58 59
59 engine_.new_usertype<MessageSystem>( 60 engine_.new_usertype<MessageSystem>(
60 "message", 61 "message",