From f2a24bc4f5956d7d59ae42fade277a7826e174da Mon Sep 17 00:00:00 2001 From: Max-001 Date: Mon, 6 Jan 2025 13:21:23 +0100 Subject: First audio --- game/GameScene.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'game/GameScene.cpp') diff --git a/game/GameScene.cpp b/game/GameScene.cpp index a8fcb47..e193f44 100644 --- a/game/GameScene.cpp +++ b/game/GameScene.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,14 @@ void GameScene::load_scene() { GameObject start_game_script = new_object("start_game_script", "script", vec2(0, 0)); start_game_script.add_component().set_script(); + GameObject background_music = new_object("background_music", "audio", vec2(0, 0)); + Asset background_music_asset {"asset/music/level.ogg"}; + background_music.add_component(background_music_asset).loop = true; + + GameObject boom_audio = new_object("boom_audio", "audio", vec2(0, 0)); + Asset boom_audio_asset {"asset/sfx/window_smash.ogg"}; + boom_audio.add_component(boom_audio_asset); + // zapper, laser and missile (below) for testing purpose only!!! GameObject zapper = new_object("zapper", "zapper", vec2(1000, 0)); Asset zapper_asset {"asset/obstacles/zapper/regular_zappers/zapEffect.png"}; -- cgit v1.2.3 From 1433845c6eb04c7b017dfad1b091f20e6ceaf823 Mon Sep 17 00:00:00 2001 From: Max-001 Date: Mon, 6 Jan 2025 13:50:13 +0100 Subject: Deleted loop --- game/GameScene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'game/GameScene.cpp') diff --git a/game/GameScene.cpp b/game/GameScene.cpp index e193f44..2b6b051 100644 --- a/game/GameScene.cpp +++ b/game/GameScene.cpp @@ -70,7 +70,7 @@ void GameScene::load_scene() { GameObject background_music = new_object("background_music", "audio", vec2(0, 0)); Asset background_music_asset {"asset/music/level.ogg"}; - background_music.add_component(background_music_asset).loop = true; + background_music.add_component(background_music_asset); GameObject boom_audio = new_object("boom_audio", "audio", vec2(0, 0)); Asset boom_audio_asset {"asset/sfx/window_smash.ogg"}; -- cgit v1.2.3