You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
526 B
29 lines
526 B
#include "Enemy.h"
|
|
|
|
Enemy::Enemy(olc::vi2d pos,Rect*sprite,int health)
|
|
:pos(pos),sprite(sprite),health(health){};
|
|
olc::vf2d Enemy::GetPos(){
|
|
return pos;
|
|
}
|
|
olc::vi2d Enemy::GetSprPos(){
|
|
return sprite->GetPos();
|
|
}
|
|
olc::vi2d Enemy::GetSprSize(){
|
|
return sprite->GetSize();
|
|
}
|
|
void Enemy::Hurt(int damage){
|
|
health-=damage;
|
|
}
|
|
bool Enemy::IsAlive(){
|
|
return health>0;
|
|
}
|
|
void Enemy::Move(olc::vi2d moveAmt){
|
|
pos+=moveAmt;
|
|
}
|
|
olc::Pixel Enemy::GetColor(){
|
|
if(health>1){
|
|
return {255,96,96};
|
|
} else {
|
|
return olc::GREEN;
|
|
}
|
|
} |