Use pathfinding algorithm to determine teleport validity.
This commit is contained in:
+2
-2
@@ -306,10 +306,10 @@ bool Wizard::RightClickAbility(){
|
||||
float dist=std::clamp(geom2d::line<float>{p.GetPos(),game->GetWorldMousePos()}.length(),0.f,6.5f*24);
|
||||
vf2d teleportPoint=p.GetPos()+pointTowardsMouse*dist;
|
||||
while(dist>0&&game->HasTileCollision(game->GetCurrentLevel(),teleportPoint)&&p.CanPathfindTo(p.GetPos(),teleportPoint)){
|
||||
dist--;
|
||||
dist-=24;
|
||||
teleportPoint=p.GetPos()+pointTowardsMouse*dist;
|
||||
}
|
||||
if(dist>0){
|
||||
if(dist>0&&p.CanPathfindTo(p.GetPos(),teleportPoint)){
|
||||
p.SetState(State::TELEPORT);
|
||||
p.teleportAnimationTimer=0.35;
|
||||
p.teleportTarget=teleportPoint;
|
||||
|
||||
Reference in New Issue
Block a user