diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-18 12:32:53 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-18 12:32:53 -0500 |
commit | c1a62ba1459cf849b5ee965aa461e10695bb0b01 (patch) | |
tree | d2dbd6493c2ea367f8673b6557ed0ac136cf71f8 | |
parent | aac57db782718bf40a7adea15baf8d6b899ea925 (diff) | |
download | tanetane-c1a62ba1459cf849b5ee965aa461e10695bb0b01.tar.gz tanetane-c1a62ba1459cf849b5ee965aa461e10695bb0b01.tar.bz2 tanetane-c1a62ba1459cf849b5ee965aa461e10695bb0b01.zip |
Started adding event where Claus joins the party
-rw-r--r-- | res/maps/map2.tmx | 14 | ||||
-rw-r--r-- | res/scripts/map2.lua | 26 | ||||
-rw-r--r-- | res/sprites/claus.png | bin | 0 -> 9024 bytes | |||
-rw-r--r-- | res/sprites/claus_anim.txt | 42 | ||||
-rw-r--r-- | res/sprites/claus_frames.txt | 57 | ||||
-rw-r--r-- | src/script_system.cpp | 7 | ||||
-rw-r--r-- | src/transform_system.cpp | 9 | ||||
-rw-r--r-- | src/transform_system.h | 2 |
8 files changed, 154 insertions, 3 deletions
diff --git a/res/maps/map2.tmx b/res/maps/map2.tmx index 1ea8c00..19d3727 100644 --- a/res/maps/map2.tmx +++ b/res/maps/map2.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="64" height="64" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="9"> | 2 | <map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="10"> |
3 | <tileset firstgid="1" name="fromRom" tilewidth="16" tileheight="16" tilecount="180" columns="10"> | 3 | <tileset firstgid="1" name="fromRom" tilewidth="16" tileheight="16" tilecount="180" columns="10"> |
4 | <image source="map2_tiles.png" width="160" height="288"/> | 4 | <image source="map2_tiles.png" width="160" height="288"/> |
5 | <tile id="61"> | 5 | <tile id="61"> |
@@ -676,6 +676,18 @@ | |||
676 | <property name="script" value="approach_doria"/> | 676 | <property name="script" value="approach_doria"/> |
677 | </properties> | 677 | </properties> |
678 | </object> | 678 | </object> |
679 | <object id="9" name="join_claus" type="sprite" x="640.334" y="153.667"> | ||
680 | <properties> | ||
681 | <property name="animation" value="../res/sprites/claus_anim.txt"/> | ||
682 | <property name="collisionHeight" type="int" value="8"/> | ||
683 | <property name="collisionOffsetX" type="int" value="-8"/> | ||
684 | <property name="collisionOffsetY" type="int" value="-8"/> | ||
685 | <property name="collisionWidth" type="int" value="12"/> | ||
686 | <property name="interactionScript" value="join_claus"/> | ||
687 | <property name="shadow" type="bool" value="true"/> | ||
688 | </properties> | ||
689 | <point/> | ||
690 | </object> | ||
679 | </objectgroup> | 691 | </objectgroup> |
680 | <layer id="1" name="Layer 0" width="64" height="64"> | 692 | <layer id="1" name="Layer 0" width="64" height="64"> |
681 | <data encoding="csv"> | 693 | <data encoding="csv"> |
diff --git a/res/scripts/map2.lua b/res/scripts/map2.lua index 295a0c1..3c3a5d9 100644 --- a/res/scripts/map2.lua +++ b/res/scripts/map2.lua | |||
@@ -24,6 +24,32 @@ function map2.mailbox1() | |||
24 | HideCutsceneBars() | 24 | HideCutsceneBars() |
25 | end | 25 | end |
26 | 26 | ||
27 | function map2.join_claus() | ||
28 | StartCutscene() | ||
29 | SetAnimation("join_claus", "talk") | ||
30 | DisplayMessage("* Say, Lucas. Whatcha up to?\n\f* It looks so fun! Let me join you!", "Claus", SpeakerType.MAN) | ||
31 | ShowChoice("Yes", "No") | ||
32 | WaitForEndOfMessage() | ||
33 | |||
34 | if GetChoiceSelection() == 0 then | ||
35 | DisplayMessage("* Yes!\n\f* Okay, then I'll be at the very end!\n* Thanks!", "Claus", SpeakerType.MAN) | ||
36 | WaitForEndOfMessage() | ||
37 | |||
38 | local clausId = getSpriteByAlias("join_claus") | ||
39 | character():addSpriteToParty(getPlayerSprite(), clausId) | ||
40 | transform():undoCollision(clausId) | ||
41 | |||
42 | local clausSprite = getSprite(clausId) | ||
43 | clausSprite.persistent = true | ||
44 | else | ||
45 | DisplayMessage("* You won't let me join in?\nWhy not? Why not?\n\f* Why won't you let me join in?", "Claus", SpeakerType.MAN) | ||
46 | WaitForEndOfMessage() | ||
47 | end | ||
48 | |||
49 | SetAnimation("join_claus", "still") | ||
50 | HideCutsceneBars() | ||
51 | end | ||
52 | |||
27 | function map2.mailbox_lightning() | 53 | function map2.mailbox_lightning() |
28 | StartCutscene() | 54 | StartCutscene() |
29 | DisplayMessage("* The mailbox lid is open...\n* Peek inside?", "", SpeakerType.NONE) | 55 | DisplayMessage("* The mailbox lid is open...\n* Peek inside?", "", SpeakerType.NONE) |
diff --git a/res/sprites/claus.png b/res/sprites/claus.png new file mode 100644 index 0000000..3e85a01 --- /dev/null +++ b/res/sprites/claus.png | |||
Binary files differ | |||
diff --git a/res/sprites/claus_anim.txt b/res/sprites/claus_anim.txt new file mode 100644 index 0000000..79cb64b --- /dev/null +++ b/res/sprites/claus_anim.txt | |||
@@ -0,0 +1,42 @@ | |||
1 | ../res/sprites/claus.png | ||
2 | ../res/sprites/claus_frames.txt | ||
3 | still[down]: 0 | ||
4 | still[down_left]: 1 | ||
5 | still[left]: 2 | ||
6 | still[up_left]: 3 | ||
7 | still[up]: 4 | ||
8 | still[up_right]: 5 | ||
9 | still[right]: 6 | ||
10 | still[down_right]: 7 | ||
11 | walk[down]: 8,0,16,0 | ||
12 | walk[down_left]: 9,1,17,1 | ||
13 | walk[left]: 10,2,18,2 | ||
14 | walk[up_left]: 11,3,19,3 | ||
15 | walk[up]: 12,4,20,4 | ||
16 | walk[up_right]: 13,5,21,5 | ||
17 | walk[right]: 14,6,22,6 | ||
18 | walk[down_right]: 15,7,23,7 | ||
19 | crouch[down]: 0 | ||
20 | crouch[down_left]: 1 | ||
21 | crouch[left]: 2 | ||
22 | crouch[up_left]: 3 | ||
23 | crouch[up]: 4 | ||
24 | crouch[up_right]: 5 | ||
25 | crouch[right]: 6 | ||
26 | crouch[down_right]: 7 | ||
27 | run[down]: 8,0,16,0 | ||
28 | run[down_left]: 9,1,17,1 | ||
29 | run[left]: 10,2,18,2 | ||
30 | run[up_left]: 11,3,19,3 | ||
31 | run[up]: 12,4,20,4 | ||
32 | run[up_right]: 13,5,21,5 | ||
33 | run[right]: 14,6,22,6 | ||
34 | run[down_right]: 15,7,23,7 | ||
35 | talk[down]: 24,0 | ||
36 | talk[down_left]: 25,1 | ||
37 | talk[left]: 26,2 | ||
38 | talk[up_left]: 27,3 | ||
39 | talk[up]: 28,4 | ||
40 | talk[up_right]: 29,5 | ||
41 | talk[right]: 30,6 | ||
42 | talk[down_right]: 31,7 \ No newline at end of file | ||
diff --git a/res/sprites/claus_frames.txt b/res/sprites/claus_frames.txt new file mode 100644 index 0000000..272ddc9 --- /dev/null +++ b/res/sprites/claus_frames.txt | |||
@@ -0,0 +1,57 @@ | |||
1 | 17,32 cell size | ||
2 | 10 frames per row | ||
3 | 53 frames | ||
4 | |||
5 | 16,32,8,32 | ||
6 | 16,32,8,32 | ||
7 | 16,32,8,32 | ||
8 | 16,32,8,32 | ||
9 | 16,32,9,32 | ||
10 | 16,32,9,32 | ||
11 | 16,32,9,32 | ||
12 | 16,32,9,32 | ||
13 | 16,24,8,24 | ||
14 | 16,24,8,24 | ||
15 | 16,24,8,24 | ||
16 | 16,24,8,24 | ||
17 | 16,24,9,24 | ||
18 | 16,24,9,24 | ||
19 | 16,24,9,24 | ||
20 | 16,24,9,24 | ||
21 | 17,24,9,24 | ||
22 | 16,24,8,24 | ||
23 | 16,24,8,24 | ||
24 | 16,24,8,24 | ||
25 | 17,24,9,24 | ||
26 | 16,24,9,24 | ||
27 | 16,24,9,24 | ||
28 | 16,24,9,24 | ||
29 | 16,32,8,32 | ||
30 | 16,32,8,32 | ||
31 | 16,32,8,32 | ||
32 | 16,32,8,32 | ||
33 | 17,32,9,32 | ||
34 | 16,32,9,32 | ||
35 | 16,32,9,32 | ||
36 | 16,32,9,32 | ||
37 | 16,32,8,32 | ||
38 | 16,24,8,24 | ||
39 | 17,32,9,32 | ||
40 | 17,24,9,24 | ||
41 | 16,24,8,24 | ||
42 | 16,24,8,24 | ||
43 | 16,24,8,24 | ||
44 | 16,24,8,24 | ||
45 | 16,24,8,24 | ||
46 | 16,24,8,24 | ||
47 | 16,24,8,24 | ||
48 | 16,24,8,24 | ||
49 | 16,24,9,24 | ||
50 | 16,24,9,24 | ||
51 | 16,24,9,24 | ||
52 | 16,24,9,24 | ||
53 | 16,24,9,24 | ||
54 | 16,24,9,24 | ||
55 | 16,24,9,24 | ||
56 | 16,24,9,24 | ||
57 | 16,24,9,24 | ||
diff --git a/src/script_system.cpp b/src/script_system.cpp index 090bf46..d4ee0ce 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
@@ -35,7 +35,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
35 | "animFinished", &Sprite::animFinished, | 35 | "animFinished", &Sprite::animFinished, |
36 | "getCurrentFrame", [] (const Sprite& sprite) -> const SpriteFrame& { | 36 | "getCurrentFrame", [] (const Sprite& sprite) -> const SpriteFrame& { |
37 | return sprite.frames[sprite.animations[sprite.animationId].frameIndices[sprite.animationFrame]]; | 37 | return sprite.frames[sprite.animations[sprite.animationId].frameIndices[sprite.animationFrame]]; |
38 | }); | 38 | }, |
39 | "persistent", &Sprite::persistent); | ||
39 | 40 | ||
40 | engine_.new_usertype<MessageSystem>( | 41 | engine_.new_usertype<MessageSystem>( |
41 | "message", | 42 | "message", |
@@ -54,6 +55,7 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
54 | 55 | ||
55 | engine_.new_usertype<CharacterSystem>( | 56 | engine_.new_usertype<CharacterSystem>( |
56 | "character", | 57 | "character", |
58 | "addSpriteToParty", &CharacterSystem::addSpriteToParty, | ||
57 | "transplantParty", &CharacterSystem::transplantParty, | 59 | "transplantParty", &CharacterSystem::transplantParty, |
58 | "startRunning", &CharacterSystem::startRunning, | 60 | "startRunning", &CharacterSystem::startRunning, |
59 | "halt", &CharacterSystem::halt); | 61 | "halt", &CharacterSystem::halt); |
@@ -62,7 +64,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
62 | "transform", | 64 | "transform", |
63 | "initSprite", [] (TransformSystem& transform, int spriteId, int x, int y, SpriteLayer layer) { | 65 | "initSprite", [] (TransformSystem& transform, int spriteId, int x, int y, SpriteLayer layer) { |
64 | transform.initSprite(spriteId, vec2i{x, y}, layer); | 66 | transform.initSprite(spriteId, vec2i{x, y}, layer); |
65 | }); | 67 | }, |
68 | "undoCollision", &TransformSystem::undoCollision); | ||
66 | 69 | ||
67 | engine_.new_usertype<EffectSystem>( | 70 | engine_.new_usertype<EffectSystem>( |
68 | "effect", | 71 | "effect", |
diff --git a/src/transform_system.cpp b/src/transform_system.cpp index 144477b..1d4a9f3 100644 --- a/src/transform_system.cpp +++ b/src/transform_system.cpp | |||
@@ -19,6 +19,15 @@ void TransformSystem::setUpCollision(int spriteId, vec2i offset, vec2i size, boo | |||
19 | addCollidable(spriteId); | 19 | addCollidable(spriteId); |
20 | } | 20 | } |
21 | 21 | ||
22 | void TransformSystem::undoCollision(int spriteId) { | ||
23 | Sprite& sprite = game_.getSprite(spriteId); | ||
24 | |||
25 | sprite.collidable = false; | ||
26 | sprite.solid = false; | ||
27 | |||
28 | removeCollidable(spriteId); | ||
29 | } | ||
30 | |||
22 | void TransformSystem::moveSprite(int spriteId, vec2i newLoc) { | 31 | void TransformSystem::moveSprite(int spriteId, vec2i newLoc) { |
23 | Sprite& sprite = game_.getSprite(spriteId); | 32 | Sprite& sprite = game_.getSprite(spriteId); |
24 | if (sprite.collidable) { | 33 | if (sprite.collidable) { |
diff --git a/src/transform_system.h b/src/transform_system.h index 4ee481e..d894b30 100644 --- a/src/transform_system.h +++ b/src/transform_system.h | |||
@@ -35,6 +35,8 @@ public: | |||
35 | 35 | ||
36 | void setUpCollision(int spriteId, vec2i offset, vec2i size, bool solid); | 36 | void setUpCollision(int spriteId, vec2i offset, vec2i size, bool solid); |
37 | 37 | ||
38 | void undoCollision(int spriteId); | ||
39 | |||
38 | void moveSprite(int spriteId, vec2i newLoc); | 40 | void moveSprite(int spriteId, vec2i newLoc); |
39 | 41 | ||
40 | auto getSpritesByY(SpriteLayer layer) const { | 42 | auto getSpritesByY(SpriteLayer layer) const { |