summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/behaviour_system.cpp2
-rw-r--r--src/character_system.cpp2
-rw-r--r--src/script_system.cpp9
-rw-r--r--src/sprite.h1
4 files changed, 11 insertions, 3 deletions
diff --git a/src/behaviour_system.cpp b/src/behaviour_system.cpp index 8f17329..6cd0b52 100644 --- a/src/behaviour_system.cpp +++ b/src/behaviour_system.cpp
@@ -9,7 +9,7 @@ void BehaviourSystem::tick(double dt) {
9 while (timer_.step()) { 9 while (timer_.step()) {
10 for (int spriteId : game_.getSprites()) { 10 for (int spriteId : game_.getSprites()) {
11 Sprite& sprite = game_.getSprite(spriteId); 11 Sprite& sprite = game_.getSprite(spriteId);
12 if (sprite.wander) { 12 if (sprite.wander && !sprite.paused) {
13 // 75% chance of changing what's happening 13 // 75% chance of changing what's happening
14 if (std::bernoulli_distribution(0.75)(game_.getRng())) { 14 if (std::bernoulli_distribution(0.75)(game_.getRng())) {
15 // 50% chance of choosing a direction or stopping 15 // 50% chance of choosing a direction or stopping
diff --git a/src/character_system.cpp b/src/character_system.cpp index e6dddf6..7b628b0 100644 --- a/src/character_system.cpp +++ b/src/character_system.cpp
@@ -96,7 +96,7 @@ void CharacterSystem::tick(double dt) {
96 for (int spriteId : game_.getSprites()) { 96 for (int spriteId : game_.getSprites()) {
97 Sprite& sprite = game_.getSprite(spriteId); 97 Sprite& sprite = game_.getSprite(spriteId);
98 98
99 if (sprite.orientable) { 99 if (sprite.orientable && !sprite.paused) {
100 vec2i pLoc = sprite.loc; 100 vec2i pLoc = sprite.loc;
101 101
102 if (sprite.characterState == CharacterState::Still || 102 if (sprite.characterState == CharacterState::Still ||
diff --git a/src/script_system.cpp b/src/script_system.cpp index d4ee0ce..3293753 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp
@@ -36,7 +36,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
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 "persistent", &Sprite::persistent,
40 "paused", &Sprite::paused);
40 41
41 engine_.new_usertype<MessageSystem>( 42 engine_.new_usertype<MessageSystem>(
42 "message", 43 "message",
@@ -168,6 +169,12 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
168 }); 169 });
169 170
170 engine_.set_function( 171 engine_.set_function(
172 "getAllSprites",
173 [&] () -> const std::set<int>& {
174 return game_.getSprites();
175 });
176
177 engine_.set_function(
171 "loadMap", 178 "loadMap",
172 [&] (std::string filename) { 179 [&] (std::string filename) {
173 game_.loadMap(filename); 180 game_.loadMap(filename);
diff --git a/src/sprite.h b/src/sprite.h index 4e3e490..35ca7aa 100644 --- a/src/sprite.h +++ b/src/sprite.h
@@ -43,6 +43,7 @@ public:
43 43
44 std::string alias; 44 std::string alias;
45 bool persistent = false; 45 bool persistent = false;
46 bool paused = false;
46 47
47 // Transform 48 // Transform
48 vec2i loc { 0, 0 }; 49 vec2i loc { 0, 0 };