summary refs log tree commit diff stats
path: root/src/behaviour_system.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-21 12:31:55 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-21 12:31:55 -0500
commitecbe17b582803aaeaa9ccee88a3d093ff93a6cd3 (patch)
treeb7e14ae55b6c38992598b8571ed217bc8f249887 /src/behaviour_system.cpp
parentf0eab98e417bf648261a9027bef91fe935af76cb (diff)
downloadtanetane-ecbe17b582803aaeaa9ccee88a3d093ff93a6cd3.tar.gz
tanetane-ecbe17b582803aaeaa9ccee88a3d093ff93a6cd3.tar.bz2
tanetane-ecbe17b582803aaeaa9ccee88a3d093ff93a6cd3.zip
Added sprite pausing
All sprites are now paused when a cutscene starts and unpaused when it ends. Pausing means that the CharacterSystem and BehaviourSystem will not process them in their tick. This allows specific sprites to be unpaused during cutscenes if movement is needed.

The player character is halted and made non-controllable by the script when the cutscene starts and made controllable again when it ends. It is important to remember that if interacting with a sprite that might be moving, you have to manually call Halt() on them in their script to make them stop moving.
Diffstat (limited to 'src/behaviour_system.cpp')
-rw-r--r--src/behaviour_system.cpp2
1 files changed, 1 insertions, 1 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