Switch to storing unique pointers for the monsters list instead of objects. Added a source monster for frog tongues to remain attached to so they follow the monster that they originated from. Release Build 8734.

This commit is contained in:
2024-04-09 00:49:04 -05:00
parent 254b4b3ea0
commit 4306f4eab8
13 changed files with 97 additions and 93 deletions
+7 -7
View File
@@ -269,14 +269,14 @@ bool Monster::Update(float fElapsedTime){
}
}
if(!HasIframes()){
for(Monster&m:MONSTER_LIST){
if(&m==this)continue;
if(!m.HasIframes()&&OnUpperLevel()==m.OnUpperLevel()&&abs(m.GetZ()-GetZ())<=1&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(m.GetPos(),12*m.GetSizeMult()/2))){
m.Collision(*this);
geom2d::line line(pos,m.GetPos());
for(std::unique_ptr<Monster>&m:MONSTER_LIST){
if(&*m==this)continue;
if(!m->HasIframes()&&OnUpperLevel()==m->OnUpperLevel()&&abs(m->GetZ()-GetZ())<=1&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(m->GetPos(),12*m->GetSizeMult()/2))){
m->Collision(*this);
geom2d::line line(pos,m->GetPos());
float dist = line.length();
m.SetPos(line.rpoint(dist*1.1f));
if(m.IsAlive()){
m->SetPos(line.rpoint(dist*1.1f));
if(m->IsAlive()){
vel=line.vector().norm()*-128;
}
}