diff options
author | Jaro <59013720+JaroWMR@users.noreply.github.com> | 2025-01-08 14:40:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-08 14:40:13 +0100 |
commit | 91366375a7b2a9be670e4842604512254a9c116e (patch) | |
tree | 537c2cfa54f338734c91e74f6db078dddd578a96 /game/coins/CoinScript.cpp | |
parent | c9c9702edc58ff8f40b13dc6b86b216421f79e9b (diff) | |
parent | a24d1563931a19332ff2935f8d5998c997a4f94e (diff) |
Merge pull request #112 from lonkaars/max/game2
Max/game2
Diffstat (limited to 'game/coins/CoinScript.cpp')
-rw-r--r-- | game/coins/CoinScript.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/game/coins/CoinScript.cpp b/game/coins/CoinScript.cpp index 90150b6..514f4de 100644 --- a/game/coins/CoinScript.cpp +++ b/game/coins/CoinScript.cpp @@ -5,6 +5,8 @@ #include "../Config.h" #include "../hud/HudScript.h" +#include <crepe/api/Animator.h> +#include <crepe/api/AudioSource.h> #include <crepe/api/CircleCollider.h> #include <crepe/api/Sprite.h> @@ -29,6 +31,24 @@ 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(); + + this->get_components_by_name<Sprite>(collisionData.info.other.metadata.name) + .back() + .get() + .active + = true; + this->get_components_by_name<Animator>(collisionData.info.other.metadata.name) + .back() + .get() + .active + = true; + return false; } |