소스 검색

Added dead check

jancoow 9 년 전
부모
커밋
d14f045708
2개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      Enemy.cpp
  2. 1 0
      Enemy.h

+ 4 - 0
Enemy.cpp

@@ -83,7 +83,11 @@ void Enemy::collide(const Entity * entity)
 }
 
 void Enemy::hit(int damage){
+	health -= damage;
+}
 
+bool Enemy::isDead(){
+	return health < 0;
 }
 
 void Enemy::update(float delta)

+ 1 - 0
Enemy.h

@@ -29,6 +29,7 @@ public:
 	void inEyeSight(Vec3f &);
 	void collide(const Entity *entity);
 	void hit(int damage);
+	bool isDead(void);
 private:
 	int hit_sound_id;
 };