summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/character_system.cpp12
-rw-r--r--src/character_system.h2
-rw-r--r--src/script_system.cpp3
3 files changed, 17 insertions, 0 deletions
diff --git a/src/character_system.cpp b/src/character_system.cpp index bcd3beb..d18c592 100644 --- a/src/character_system.cpp +++ b/src/character_system.cpp
@@ -70,6 +70,18 @@ void CharacterSystem::transplantParty(int leaderId, vec2i pos, Direction dir) {
70 } 70 }
71} 71}
72 72
73void CharacterSystem::breakUpParty(int leaderId) {
74 Sprite& leader = game_.getSprite(leaderId);
75 std::vector<int> followers = leader.followers;
76 leader.followers.clear();
77 leader.trailsAreHalved = false;
78
79 for (int followerId : followers) {
80 Sprite& follower = game_.getSprite(followerId);
81 follower.trail.clear();
82 }
83}
84
73void CharacterSystem::moveInDirection(int spriteId, Direction dir) { 85void CharacterSystem::moveInDirection(int spriteId, Direction dir) {
74 Sprite& sprite = game_.getSprite(spriteId); 86 Sprite& sprite = game_.getSprite(spriteId);
75 sprite.movementDir = dir; 87 sprite.movementDir = dir;
diff --git a/src/character_system.h b/src/character_system.h index 0962a6a..dff2a7f 100644 --- a/src/character_system.h +++ b/src/character_system.h
@@ -25,6 +25,8 @@ public:
25 25
26 void transplantParty(int leaderId, vec2i pos, Direction dir); 26 void transplantParty(int leaderId, vec2i pos, Direction dir);
27 27
28 void breakUpParty(int leaderId);
29
28 void moveInDirection(int spriteId, Direction dir); 30 void moveInDirection(int spriteId, Direction dir);
29 31
30 void stopDirecting(int spriteId); 32 void stopDirecting(int spriteId);
diff --git a/src/script_system.cpp b/src/script_system.cpp index e890dfc..0d82436 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp
@@ -59,6 +59,9 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
59 "character", 59 "character",
60 "addSpriteToParty", &CharacterSystem::addSpriteToParty, 60 "addSpriteToParty", &CharacterSystem::addSpriteToParty,
61 "transplantParty", &CharacterSystem::transplantParty, 61 "transplantParty", &CharacterSystem::transplantParty,
62 "breakUpParty", &CharacterSystem::breakUpParty,
63 "moveInDirection", &CharacterSystem::moveInDirection,
64 "stopDirecting", &CharacterSystem::stopDirecting,
62 "startRunning", &CharacterSystem::startRunning, 65 "startRunning", &CharacterSystem::startRunning,
63 "halt", &CharacterSystem::halt); 66 "halt", &CharacterSystem::halt);
64 67