diff options
author | Wboerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-07 14:12:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-07 14:12:28 +0100 |
commit | 80b2c59068f97ff69a2ba77788c4861b10535328 (patch) | |
tree | 30500bf55a2a8d3b1995b72675f0321bd364b9ce /game/GameScene.cpp | |
parent | 77d02bf2e2d5d04e8cacb3c783446541517e8e76 (diff) | |
parent | a2d9f875a219d6d1c53784a307b4915cc4e1ee14 (diff) |
Merge pull request #103 from lonkaars/max/game
Max/game (audio)
Diffstat (limited to 'game/GameScene.cpp')
-rw-r--r-- | game/GameScene.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/game/GameScene.cpp b/game/GameScene.cpp index a8fcb47..2b6b051 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); + + 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"}; |