diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2025-01-03 16:12:14 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2025-01-03 16:12:14 +0100 |
commit | f18635b6c73f753bd38343684134430a5ce9b22c (patch) | |
tree | e838c01914244c517b17d6359241a8cbf78ac6ae /game/coins/CoinScript.cpp | |
parent | b82c302e2eb5044ae966230a50aae9bdb698cf8c (diff) |
added coins random and menu banner update
Diffstat (limited to 'game/coins/CoinScript.cpp')
-rw-r--r-- | game/coins/CoinScript.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/game/coins/CoinScript.cpp b/game/coins/CoinScript.cpp new file mode 100644 index 0000000..f067f04 --- /dev/null +++ b/game/coins/CoinScript.cpp @@ -0,0 +1,19 @@ +#include "CoinScript.h" +#include "api/CircleCollider.h" +#include "api/Sprite.h" + +using namespace crepe; +using namespace std; + +bool CoinScript::on_collision(const CollisionEvent & collisionData){ + if(collisionData.info.other.metadata.name != PLAYER_NAME) return true; + //collide with player + this->get_component<Sprite>().active = false; + this->get_component<CircleCollider>().active = false; + return true; +} + +void CoinScript::init(){ + subscribe<CollisionEvent>([this](const CollisionEvent & ev) -> bool { return this->on_collision(ev); }); +} + |