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 /src | |
parent | aac57db782718bf40a7adea15baf8d6b899ea925 (diff) | |
download | tanetane-c1a62ba1459cf849b5ee965aa461e10695bb0b01.tar.gz tanetane-c1a62ba1459cf849b5ee965aa461e10695bb0b01.tar.bz2 tanetane-c1a62ba1459cf849b5ee965aa461e10695bb0b01.zip |
Started adding event where Claus joins the party
Diffstat (limited to 'src')
-rw-r--r-- | src/script_system.cpp | 7 | ||||
-rw-r--r-- | src/transform_system.cpp | 9 | ||||
-rw-r--r-- | src/transform_system.h | 2 |
3 files changed, 16 insertions, 2 deletions
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 { |