summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-18 12:32:53 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-18 12:32:53 -0500
commitc1a62ba1459cf849b5ee965aa461e10695bb0b01 (patch)
treed2dbd6493c2ea367f8673b6557ed0ac136cf71f8
parentaac57db782718bf40a7adea15baf8d6b899ea925 (diff)
downloadtanetane-c1a62ba1459cf849b5ee965aa461e10695bb0b01.tar.gz
tanetane-c1a62ba1459cf849b5ee965aa461e10695bb0b01.tar.bz2
tanetane-c1a62ba1459cf849b5ee965aa461e10695bb0b01.zip
Started adding event where Claus joins the party
-rw-r--r--res/maps/map2.tmx14
-rw-r--r--res/scripts/map2.lua26
-rw-r--r--res/sprites/claus.pngbin0 -> 9024 bytes
-rw-r--r--res/sprites/claus_anim.txt42
-rw-r--r--res/sprites/claus_frames.txt57
-rw-r--r--src/script_system.cpp7
-rw-r--r--src/transform_system.cpp9
-rw-r--r--src/transform_system.h2
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()
25end 25end
26 26
27function 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()
51end
52
27function map2.mailbox_lightning() 53function 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
3still[down]: 0
4still[down_left]: 1
5still[left]: 2
6still[up_left]: 3
7still[up]: 4
8still[up_right]: 5
9still[right]: 6
10still[down_right]: 7
11walk[down]: 8,0,16,0
12walk[down_left]: 9,1,17,1
13walk[left]: 10,2,18,2
14walk[up_left]: 11,3,19,3
15walk[up]: 12,4,20,4
16walk[up_right]: 13,5,21,5
17walk[right]: 14,6,22,6
18walk[down_right]: 15,7,23,7
19crouch[down]: 0
20crouch[down_left]: 1
21crouch[left]: 2
22crouch[up_left]: 3
23crouch[up]: 4
24crouch[up_right]: 5
25crouch[right]: 6
26crouch[down_right]: 7
27run[down]: 8,0,16,0
28run[down_left]: 9,1,17,1
29run[left]: 10,2,18,2
30run[up_left]: 11,3,19,3
31run[up]: 12,4,20,4
32run[up_right]: 13,5,21,5
33run[right]: 14,6,22,6
34run[down_right]: 15,7,23,7
35talk[down]: 24,0
36talk[down_left]: 25,1
37talk[left]: 26,2
38talk[up_left]: 27,3
39talk[up]: 28,4
40talk[up_right]: 29,5
41talk[right]: 30,6
42talk[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 @@
117,32 cell size
210 frames per row
353 frames
4
516,32,8,32
616,32,8,32
716,32,8,32
816,32,8,32
916,32,9,32
1016,32,9,32
1116,32,9,32
1216,32,9,32
1316,24,8,24
1416,24,8,24
1516,24,8,24
1616,24,8,24
1716,24,9,24
1816,24,9,24
1916,24,9,24
2016,24,9,24
2117,24,9,24
2216,24,8,24
2316,24,8,24
2416,24,8,24
2517,24,9,24
2616,24,9,24
2716,24,9,24
2816,24,9,24
2916,32,8,32
3016,32,8,32
3116,32,8,32
3216,32,8,32
3317,32,9,32
3416,32,9,32
3516,32,9,32
3616,32,9,32
3716,32,8,32
3816,24,8,24
3917,32,9,32
4017,24,9,24
4116,24,8,24
4216,24,8,24
4316,24,8,24
4416,24,8,24
4516,24,8,24
4616,24,8,24
4716,24,8,24
4816,24,8,24
4916,24,9,24
5016,24,9,24
5116,24,9,24
5216,24,9,24
5316,24,9,24
5416,24,9,24
5516,24,9,24
5616,24,9,24
5716,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
22void 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
22void TransformSystem::moveSprite(int spriteId, vec2i newLoc) { 31void 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 {