diff --git a/Crystal.cpp b/Crystal.cpp index 6ced677..c1f4957 100644 --- a/Crystal.cpp +++ b/Crystal.cpp @@ -7,18 +7,22 @@ Crystal::Crystal(const std::string & filled, const std::string & empty, const Ve { this->filled = Model::load(filled); this->empty = Model::load(empty); - model = this->filled; - + model = this->filled; this->position = position; this->rotation = rotation; this->scale = scale; this->canCollide = true; isFilled = true; + + sound_id = CrystalPoint::GetSoundSystem().LoadSound("WAVE/Crystal.wav", false); + music = CrystalPoint::GetSoundSystem().GetSound(sound_id); + music->SetPos(position, Vec3f()); } Crystal::~Crystal() { + CrystalPoint::GetSoundSystem().UnloadSound(sound_id); if (model) Model::unload(model); @@ -41,6 +45,7 @@ void Crystal::collide() { if (isFilled) { + music->Play(); Player::getInstance()->crystals++; isFilled = false; model = empty; diff --git a/Crystal.h b/Crystal.h index 1f9a54f..5dbc03e 100644 --- a/Crystal.h +++ b/Crystal.h @@ -1,6 +1,7 @@ #pragma once #include "Entity.h" #include +#include "CrystalPoint.h" class Crystal : public Entity @@ -14,6 +15,8 @@ public: void draw(); void collide(); private: + int sound_id; + Sound* music; Model* filled; Model* empty; }; diff --git a/CrystalPoint.vcxproj b/CrystalPoint.vcxproj index b34fc2c..f1d145e 100644 --- a/CrystalPoint.vcxproj +++ b/CrystalPoint.vcxproj @@ -216,8 +216,11 @@ - - + + + + + diff --git a/CrystalPoint.vcxproj.filters b/CrystalPoint.vcxproj.filters index 717aedc..7f1d60c 100644 --- a/CrystalPoint.vcxproj.filters +++ b/CrystalPoint.vcxproj.filters @@ -204,10 +204,19 @@ - + Resource Files - + + Resource Files + + + Resource Files + + + Resource Files + + Resource Files diff --git a/WAVE/Crystal.wav b/WAVE/Crystal.wav new file mode 100644 index 0000000..2d13707 Binary files /dev/null and b/WAVE/Crystal.wav differ diff --git a/WAVE/enemy.wav b/WAVE/enemy.wav deleted file mode 100644 index 89e9dae..0000000 Binary files a/WAVE/enemy.wav and /dev/null differ diff --git a/WAVE/ghostEnemy.wav b/WAVE/ghostEnemy.wav new file mode 100644 index 0000000..ccbd83d Binary files /dev/null and b/WAVE/ghostEnemy.wav differ diff --git a/worlds/small.json b/worlds/small.json index fbec10a..528b74f 100644 --- a/worlds/small.json +++ b/worlds/small.json @@ -24,17 +24,17 @@ "file": "models/squid/Blooper.obj", "pos": [ 20, 5, 10 ], "scale": 0.01, - "music": "WAVE/enemy.wav" + "music": "WAVE/ghostEnemy.wav" }, { "file": "models/squid/Blooper.obj", "pos": [ 30, 10, 10 ], "scale": 0.01, - "music": "WAVE/enemy.wav" + "music": "WAVE/ghostEnemy.wav" }], "crystal": { "full texture": "models/crystal/Crystal.obj", - "empty texture": "models/crystal/PickedUpCrystal.obj", + "empty texture": "models/crystal/PickedUpCrystal.obj", "instances": [ { "pos": [ 31, 5, 33 ],