revert commit

This commit is contained in:
Remco
2016-06-22 02:00:30 +02:00
4 changed files with 8 additions and 22 deletions
+3 -16
View File
@@ -28,9 +28,7 @@ Enemy::Enemy(const std::string &fileName,
hasTarget = false;
hit_sound_id = CrystalPoint::GetSoundSystem().LoadSound(fileMusic.c_str(), false);
music = CrystalPoint::GetSoundSystem().GetSound(hit_sound_id);
canAttack = false;
lastAttacked = 0;
attack = false;
}
@@ -82,17 +80,6 @@ void Enemy::collide(const Entity * entity)
position.z = difference.z + entity->position.z;
}
bool Enemy::attack()
{
float timeNow = glutGet(GLUT_ELAPSED_TIME)/1000.0f;
if (canAttack && timeNow - lastAttacked > 0.8)
{
lastAttacked = timeNow;
return true;
}
return false;
}
void Enemy::update(float delta)
{
music->SetPos(position, Vec3f());
@@ -112,7 +99,7 @@ void Enemy::update(float delta)
length = sqrt(dx*dx + dz*dz);
if (length > 1)
{
canAttack = false;
attack = false;
dx /= length;
dz /= length;
@@ -125,7 +112,7 @@ void Enemy::update(float delta)
}
else
{
canAttack = true;
attack = true;
}
rotation.y = atan2f(dx, dz) * 180 / M_PI;
}