optimiasted crystal, entity now has a collide methode, which will be called when an entity collison has with the player.

This commit is contained in:
Remco
2016-06-09 12:35:00 +02:00
parent 1f3188376a
commit 9cfaf07eba
6 changed files with 19 additions and 25 deletions
+8 -3
View File
@@ -1,5 +1,6 @@
#include "Crystal.h"
#include "Model.h"
#include "Player.h"
Crystal::Crystal(const std::string & filled, const std::string & empty, const Vec3f & position, Vec3f & rotation, const float & scale)
@@ -26,8 +27,12 @@ void Crystal::draw()
Entity::draw();
}
void Crystal::pickUp()
void Crystal::collide()
{
isFilled = false;
model = Model::load(empty);
if (isFilled)
{
Player::getInstance()->crystals++;
isFilled = false;
model = Model::load(empty);
}
}