diff options
author | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-12 10:52:58 +0100 |
---|---|---|
committer | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-12 10:52:58 +0100 |
commit | 6e45c7c1f4c40fc724e0727342d23417c4cabfa0 (patch) | |
tree | 09be7d63d6ec9fe0500538c7192ede3fe542a41e /game/preview | |
parent | 57a51aec9220b6f3874f6f930b1a71a59f5494e0 (diff) |
Bug fix: Audio
Diffstat (limited to 'game/preview')
-rw-r--r-- | game/preview/PrevPlayerScript.cpp | 2 | ||||
-rw-r--r-- | game/preview/PrevPlayerSubScene.cpp | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/game/preview/PrevPlayerScript.cpp b/game/preview/PrevPlayerScript.cpp index c63c1c8..f5a770a 100644 --- a/game/preview/PrevPlayerScript.cpp +++ b/game/preview/PrevPlayerScript.cpp @@ -66,7 +66,7 @@ bool PrevPlayerScript::key_pressed(const KeyPressEvent & ev) { this->head->data.position_offset -= 10; break; case Keycode::P: - this->get_component<AudioSource>().play(); + this->get_component<AudioSource>().active = true; break; case Keycode::J: this->get_components_by_name<Transform>("camera").front().get().position.x diff --git a/game/preview/PrevPlayerSubScene.cpp b/game/preview/PrevPlayerSubScene.cpp index 56a434a..831167a 100644 --- a/game/preview/PrevPlayerSubScene.cpp +++ b/game/preview/PrevPlayerSubScene.cpp @@ -78,5 +78,9 @@ PrevPlayerSubScene::PrevPlayerSubScene(Scene & scn) { }); player.add_component<BoxCollider>(vec2(50, 50)); player.add_component<BehaviorScript>().set_script<PrevPlayerScript>(); - player.add_component<AudioSource>(Asset {"asset/music/level.ogg"}).stop(); + + AudioSource & audio = player.add_component<AudioSource>(Asset {"asset/music/level.ogg"}); + audio.loop = true; + audio.play_on_awake = true; + audio.active = false; } |