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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user