aboutsummaryrefslogtreecommitdiff
path: root/game/GameScene.cpp
diff options
context:
space:
mode:
authorMax-001 <maxsmits21@kpnmail.nl>2025-01-06 13:21:23 +0100
committerMax-001 <maxsmits21@kpnmail.nl>2025-01-06 13:21:23 +0100
commitf2a24bc4f5956d7d59ae42fade277a7826e174da (patch)
treef14164639dfd119385a08d2e28a76a1103db8cdb /game/GameScene.cpp
parent77d02bf2e2d5d04e8cacb3c783446541517e8e76 (diff)
First audio
Diffstat (limited to 'game/GameScene.cpp')
-rw-r--r--game/GameScene.cpp9
1 files changed, 9 insertions, 0 deletions
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 <cmath>
#include <crepe/api/Animator.h>
#include <crepe/api/Asset.h>
+#include <crepe/api/AudioSource.h>
#include <crepe/api/BehaviorScript.h>
#include <crepe/api/BoxCollider.h>
#include <crepe/api/Camera.h>
@@ -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<BehaviorScript>().set_script<StartGameScript>();
+ GameObject background_music = new_object("background_music", "audio", vec2(0, 0));
+ Asset background_music_asset {"asset/music/level.ogg"};
+ background_music.add_component<AudioSource>(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<AudioSource>(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"};