Warrior refactor completed

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
2023-07-13 20:24:47 +00:00
parent 7388ffc923
commit d3454727cd
16 changed files with 464 additions and 382 deletions
+6 -6
View File
@@ -119,14 +119,14 @@ bool Monster::Update(float fElapsedTime){
}
}
}
if(!game->GetPlayer().HasIframes()&&game->GetPlayer().OnUpperLevel()==OnUpperLevel()&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(game->GetPlayer().GetPos(),12*game->GetPlayer().GetSizeMult()/2))){
geom2d::line line(pos,game->GetPlayer().GetPos());
if(!game->GetPlayer()->HasIframes()&&game->GetPlayer()->OnUpperLevel()==OnUpperLevel()&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(game->GetPlayer()->GetPos(),12*game->GetPlayer()->GetSizeMult()/2))){
geom2d::line line(pos,game->GetPlayer()->GetPos());
float dist = line.length();
SetPosition(line.rpoint(-0.1));
vel=line.vector().norm()*-128;
}
if(state==NORMAL){
if(game->GetPlayer().GetX()>pos.x){
if(game->GetPlayer()->GetX()>pos.x){
facingDirection=RIGHT;
} else {
facingDirection=LEFT;
@@ -137,7 +137,7 @@ bool Monster::Update(float fElapsedTime){
targetAcquireTimer=std::max(0.f,targetAcquireTimer-fElapsedTime);
if(targetAcquireTimer==0){
targetAcquireTimer=3;
target=geom2d::line(pos,game->GetPlayer().GetPos()).upoint(1.2);
target=geom2d::line(pos,game->GetPlayer()->GetPos()).upoint(1.2);
state=MOVE_TOWARDS;
hasHitPlayer=false;
}
@@ -169,11 +169,11 @@ bool Monster::Update(float fElapsedTime){
if(queueShotTimer<0){
queueShotTimer=0;
{
BULLET_LIST.push_back(std::make_unique<Bullet>(Bullet(pos + vf2d{ 0,-4 }, geom2d::line(pos + vf2d{ 0,-4 }, game->GetPlayer().GetPos()).vector().norm() * 24 * 3.f, 2, GetAttack(),upperLevel,false, { 75 / 2,162 / 2,225 / 2 })));
BULLET_LIST.push_back(std::make_unique<Bullet>(Bullet(pos + vf2d{ 0,-4 }, geom2d::line(pos + vf2d{ 0,-4 }, game->GetPlayer()->GetPos()).vector().norm() * 24 * 3.f, 2, GetAttack(),upperLevel,false, { 75 / 2,162 / 2,225 / 2 })));
}
}
}
geom2d::line line(pos,game->GetPlayer().GetPos());
geom2d::line line(pos,game->GetPlayer()->GetPos());
if(targetAcquireTimer==0&&queueShotTimer==0){
targetAcquireTimer=1;
if(line.length()<24*6){