aboutsummaryrefslogtreecommitdiff
path: root/game/StartGameScript.cpp
diff options
context:
space:
mode:
authorWboerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-07 14:12:28 +0100
committerGitHub <noreply@github.com>2025-01-07 14:12:28 +0100
commit80b2c59068f97ff69a2ba77788c4861b10535328 (patch)
tree30500bf55a2a8d3b1995b72675f0321bd364b9ce /game/StartGameScript.cpp
parent77d02bf2e2d5d04e8cacb3c783446541517e8e76 (diff)
parenta2d9f875a219d6d1c53784a307b4915cc4e1ee14 (diff)
Merge pull request #103 from lonkaars/max/game
Max/game (audio)
Diffstat (limited to 'game/StartGameScript.cpp')
-rw-r--r--game/StartGameScript.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/game/StartGameScript.cpp b/game/StartGameScript.cpp
index c786eb4..e88b329 100644
--- a/game/StartGameScript.cpp
+++ b/game/StartGameScript.cpp
@@ -1,7 +1,9 @@
#include "StartGameScript.h"
#include "Config.h"
+#include "api/BehaviorScript.h"
#include <crepe/api/Animator.h>
+#include <crepe/api/AudioSource.h>
#include <crepe/api/ParticleEmitter.h>
#include <crepe/api/Sprite.h>
@@ -34,6 +36,14 @@ void StartGameScript::fixed_update(crepe::duration_t dt) {
emitter.active = true;
}
+ AudioSource & boom_audio
+ = this->get_components_by_name<AudioSource>("boom_audio").front();
+ boom_audio.play();
+
+ BehaviorScript & player_audio_script
+ = this->get_components_by_name<BehaviorScript>("player_audio").front();
+ player_audio_script.active = true;
+
this->created_hole = true;
}
@@ -45,6 +55,10 @@ void StartGameScript::fixed_update(crepe::duration_t dt) {
Sprite & jetpack_sprite = this->get_components_by_name<Sprite>("player").back();
jetpack_sprite.active = true;
+ AudioSource & background_music
+ = this->get_components_by_name<AudioSource>("background_music").front();
+ background_music.play(true);
+
this->took_jetpack = true;
}