|
|
|
@ -61,7 +61,7 @@ safemap<std::string,std::function<void(Monster&,float,std::string)>>STRATEGY_DAT |
|
|
|
|
std::map<std::string,Renderable*>MonsterData::imgs; |
|
|
|
|
|
|
|
|
|
Monster::Monster(vf2d pos,MonsterData data,bool upperLevel,bool bossMob): |
|
|
|
|
pos(pos),hp(data.GetHealth()),size(data.GetSizeMult()),targetSize(data.GetSizeMult()),strategy(data.GetAIStrategy()),name(data.GetDisplayName()),upperLevel(upperLevel),isBoss(bossMob),facingDirection(DOWN){ |
|
|
|
|
pos(pos),spawnPos(pos),hp(data.GetHealth()),size(data.GetSizeMult()),targetSize(data.GetSizeMult()),strategy(data.GetAIStrategy()),name(data.GetDisplayName()),upperLevel(upperLevel),isBoss(bossMob),facingDirection(DOWN){ |
|
|
|
|
bool firstAnimation=true; |
|
|
|
|
for(std::string&anim:data.GetAnimations()){ |
|
|
|
|
animation.AddState(anim,ANIMATION_DATA[anim]); |
|
|
|
@ -376,6 +376,15 @@ void Monster::Moved(){ |
|
|
|
|
monsterWalkSoundTimer-=1.f; |
|
|
|
|
SoundEffect::PlaySFX(GetWalkSound(),GetPos()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!std::isfinite(pos.x)){ |
|
|
|
|
ERR(std::format("WARNING! Player X position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.x)); |
|
|
|
|
pos.x=spawnPos.x; |
|
|
|
|
} |
|
|
|
|
if(!std::isfinite(pos.y)){ |
|
|
|
|
ERR(std::format("WARNING! Player Y position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.y)); |
|
|
|
|
pos.y=spawnPos.y; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
std::string Monster::GetDeathAnimationName(){ |
|
|
|
|
return MONSTER_DATA[name].GetDeathAnimation(); |
|
|
|
|