Bugfixes, added sound to portal and enemy in JSON

This commit is contained in:
2016-06-21 13:51:16 +02:00
parent 7c4805d899
commit 8700aa90af
18 changed files with 98 additions and 22 deletions
+28
View File
@@ -15,6 +15,13 @@ Portal::Portal(const std::string &fileName,
this->scale = scale;
this->canCollide = true;
started = false;
delay = 0;
sound_id = CrystalPoint::GetSoundSystem().LoadSound("WAVE/portal.wav", false);
music = CrystalPoint::GetSoundSystem().GetSound(sound_id);
music->SetPos(position, Vec3f());
mayEnter = false;
maxCrystals = 0;
}
@@ -22,6 +29,8 @@ Portal::Portal(const std::string &fileName,
Portal::~Portal()
{
// Model::unload(model);
// delete music;
}
void Portal::collide()
@@ -32,3 +41,22 @@ void Portal::collide()
mayEnter = true;
}
}
bool Portal::enter(float deltaTime)
{
if (delay > 3 && started)
{
delete music;
delay = 0;
return true;
}
if (delay == 0 && !started)
{
music->Play();
started = true;
}
delay += deltaTime;
return false;
}