From 312a3738359cc4841cb3ce675583094becd8e830 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 10 Feb 2021 18:12:15 -0500 Subject: Running is preserved across screen transitions --- src/script_system.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/script_system.cpp') 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 @@ #include "game.h" #include "message_system.h" #include "animation_system.h" +#include "character_system.h" ScriptSystem::ScriptSystem(Game& game) : game_(game) { engine_.open_libraries( @@ -13,7 +14,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { engine_.new_usertype( "sprite", "dir", &Sprite::dir, - "followers", &Sprite::followers); + "followers", &Sprite::followers, + "characterState", &Sprite::characterState); engine_.new_usertype( "message", @@ -26,6 +28,10 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { "setSpriteAnimation", &AnimationSystem::setSpriteAnimation, "setSpriteDirection", &AnimationSystem::setSpriteDirection); + engine_.new_usertype( + "character", + "startRunning", &CharacterSystem::startRunning); + engine_.new_usertype( "mixer", "playSound", &Mixer::playSound, @@ -44,6 +50,12 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { return game_.getSystem(); }); + engine_.set_function( + "character", + [&] () -> CharacterSystem& { + return game_.getSystem(); + }); + engine_.set_function( "mixer", [&] () -> Mixer& { -- cgit 1.4.1