diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 18:12:15 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 18:12:15 -0500 |
| commit | 312a3738359cc4841cb3ce675583094becd8e830 (patch) | |
| tree | 7028d5fa8fdc0f98653e4638452daeaa4120ce41 /src/script_system.cpp | |
| parent | ee7077c7ff0c22a4909c15ab34aed777b45b977e (diff) | |
| download | tanetane-312a3738359cc4841cb3ce675583094becd8e830.tar.gz tanetane-312a3738359cc4841cb3ce675583094becd8e830.tar.bz2 tanetane-312a3738359cc4841cb3ce675583094becd8e830.zip | |
Running is preserved across screen transitions
Diffstat (limited to 'src/script_system.cpp')
| -rw-r--r-- | src/script_system.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
| diff --git a/src/script_system.cpp b/src/script_system.cpp index 6b35b73..d8d93e3 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | #include "game.h" | 3 | #include "game.h" |
| 4 | #include "message_system.h" | 4 | #include "message_system.h" |
| 5 | #include "animation_system.h" | 5 | #include "animation_system.h" |
| 6 | #include "character_system.h" | ||
| 6 | 7 | ||
| 7 | ScriptSystem::ScriptSystem(Game& game) : game_(game) { | 8 | ScriptSystem::ScriptSystem(Game& game) : game_(game) { |
| 8 | engine_.open_libraries( | 9 | engine_.open_libraries( |
| @@ -13,7 +14,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
| 13 | engine_.new_usertype<Sprite>( | 14 | engine_.new_usertype<Sprite>( |
| 14 | "sprite", | 15 | "sprite", |
| 15 | "dir", &Sprite::dir, | 16 | "dir", &Sprite::dir, |
| 16 | "followers", &Sprite::followers); | 17 | "followers", &Sprite::followers, |
| 18 | "characterState", &Sprite::characterState); | ||
| 17 | 19 | ||
| 18 | engine_.new_usertype<MessageSystem>( | 20 | engine_.new_usertype<MessageSystem>( |
| 19 | "message", | 21 | "message", |
| @@ -26,6 +28,10 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
| 26 | "setSpriteAnimation", &AnimationSystem::setSpriteAnimation, | 28 | "setSpriteAnimation", &AnimationSystem::setSpriteAnimation, |
| 27 | "setSpriteDirection", &AnimationSystem::setSpriteDirection); | 29 | "setSpriteDirection", &AnimationSystem::setSpriteDirection); |
| 28 | 30 | ||
| 31 | engine_.new_usertype<CharacterSystem>( | ||
| 32 | "character", | ||
| 33 | "startRunning", &CharacterSystem::startRunning); | ||
| 34 | |||
| 29 | engine_.new_usertype<Mixer>( | 35 | engine_.new_usertype<Mixer>( |
| 30 | "mixer", | 36 | "mixer", |
| 31 | "playSound", &Mixer::playSound, | 37 | "playSound", &Mixer::playSound, |
| @@ -45,6 +51,12 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
| 45 | }); | 51 | }); |
| 46 | 52 | ||
| 47 | engine_.set_function( | 53 | engine_.set_function( |
| 54 | "character", | ||
| 55 | [&] () -> CharacterSystem& { | ||
| 56 | return game_.getSystem<CharacterSystem>(); | ||
| 57 | }); | ||
| 58 | |||
| 59 | engine_.set_function( | ||
| 48 | "mixer", | 60 | "mixer", |
| 49 | [&] () -> Mixer& { | 61 | [&] () -> Mixer& { |
| 50 | return game_.getMixer(); | 62 | return game_.getMixer(); |
