Finished slime king jump attack, account for Z axis when determining damage validity.

This commit is contained in:
2023-09-11 05:27:36 -05:00
parent 942e8e0ef7
commit 100a3ece57
14 changed files with 39 additions and 25 deletions
+5 -5
View File
@@ -427,7 +427,7 @@ void Crawler::UpdateBullets(float fElapsedTime){
if(b->friendly){
for(Monster&m:MONSTER_LIST){
if(geom2d::overlaps(geom2d::circle(m.GetPos(),12*m.GetSizeMult()),geom2d::circle(b->pos,b->radius))){
if(b->hitList.find(&m)==b->hitList.end()&&m.Hurt(b->damage,b->OnUpperLevel())){
if(b->hitList.find(&m)==b->hitList.end()&&m.Hurt(b->damage,b->OnUpperLevel(),0)){
if(!b->hitsMultiple){
if(b->MonsterHit(m)){
b->dead=true;
@@ -440,7 +440,7 @@ void Crawler::UpdateBullets(float fElapsedTime){
}
} else {
if(geom2d::overlaps(geom2d::circle(player->GetPos(),12*player->GetSizeMult()/2),geom2d::circle(b->pos,b->radius))){
if(player->Hurt(b->damage,b->OnUpperLevel())){
if(player->Hurt(b->damage,b->OnUpperLevel(),0)){
if(b->PlayerHit(player.get())){
b->dead=true;
continue;
@@ -465,10 +465,10 @@ void Crawler::UpdateBullets(float fElapsedTime){
outsideBulletLoop:
std::erase_if(BULLET_LIST,[](std::unique_ptr<Bullet>&b){return b->dead;});
}
void Crawler::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel){
void Crawler::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z){
for(Monster&m:MONSTER_LIST){
if(geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(m.GetPos(),12*m.GetSizeMult()))){
m.Hurt(damage,upperLevel);
m.Hurt(damage,upperLevel,z);
}
}
}
@@ -840,7 +840,7 @@ vf2d Crawler::GetWorldMousePos(){
void Crawler::SetupWorldShake(float duration){
worldShakeVel={750,-750};
worldShakeTime=duration;
worldShake=player->GetPos();
worldShake=vf2d{player->GetPos()};
camera.SetTarget(worldShake);
}