Merge pull request #31 from CrystalPointA4/feature/loadingscreen

Feature/loadingscreen (reverted from commit 316d6c9e14)
This commit is contained in:
jancoow
2016-06-22 03:09:28 +02:00
parent 9a31e09bff
commit 92460b8ca4
25 changed files with 180 additions and 194 deletions
+27 -1
View File
@@ -2,6 +2,7 @@
#include <cmath>
#include "Enemy.h"
#include "Model.h"
#include "Player.h"
#include <iostream>
Enemy::Enemy(const std::string &fileName,
@@ -28,7 +29,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);
attack = false;
attack = false;
}
@@ -66,6 +67,14 @@ void Enemy::collide(const Entity * entity)
position.z = difference.z + entity->position.z;
}
void Enemy::hit(int damage){
health -= damage;
}
bool Enemy::isDead(){
return health < 0;
}
void Enemy::update(float delta)
{
music->SetPos(position, Vec3f());
@@ -102,4 +111,21 @@ void Enemy::update(float delta)
}
rotation.y = atan2f(dx, dz) * 180 / M_PI;
}
Player *player = Player::getInstance();
if(inObject(player->position + player->leftWeapon->collisionPoint)){
if(!isHit){
isHit = true;
hit(player->leftWeapon->damage);
}
std::cout << "HIT1";
}else if(inObject(player->rightWeapon->collisionPoint)){
if(!isHit){
isHit = true;
hit(player->rightWeapon->damage);
}
std::cout << "HIT2";
}else{
isHit = false;
}
}