aboutsummaryrefslogtreecommitdiff
path: root/game/coins/CoinScript.cpp
diff options
context:
space:
mode:
authorMax-001 <maxsmits21@kpnmail.nl>2025-01-08 12:52:52 +0100
committerMax-001 <maxsmits21@kpnmail.nl>2025-01-08 12:52:52 +0100
commitb5ed442444d7243935f7ba58c7d0e0ada743d230 (patch)
tree2cb6d82fa6f56cda09c989bce155259dcc1754f1 /game/coins/CoinScript.cpp
parentb1e2df1e75e7fc8ea4c30b7deaa54a7acf02d951 (diff)
Added coin pickup sound
Diffstat (limited to 'game/coins/CoinScript.cpp')
-rw-r--r--game/coins/CoinScript.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/game/coins/CoinScript.cpp b/game/coins/CoinScript.cpp
index 90150b6..c5ca62c 100644
--- a/game/coins/CoinScript.cpp
+++ b/game/coins/CoinScript.cpp
@@ -5,6 +5,7 @@
#include "../Config.h"
#include "../hud/HudScript.h"
+#include <crepe/api/AudioSource.h>
#include <crepe/api/CircleCollider.h>
#include <crepe/api/Sprite.h>
@@ -29,6 +30,13 @@ bool CoinScript::on_collision(const CollisionEvent & collisionData) {
.active
= false;
this->amount++;
+
+ AudioSource & audio = this->get_components_by_id<AudioSource>(
+ collisionData.info.other.metadata.game_object_id
+ )
+ .front();
+ audio.play();
+
return false;
}