Fix teleport ability, reverse logic in has tile collision. Also use precise collision checking for tiles. Teleporting distance clamping is now proper (650 range)

This commit is contained in:
2023-07-05 18:29:04 +00:00
parent 888d2a91a6
commit d658bb9973
4 changed files with 8 additions and 11 deletions
+1 -1
View File
@@ -303,7 +303,7 @@ bool Wizard::RightClickAbility(){
ACCESS_PLAYER
float pointMouseDirection=atan2(game->GetWorldMousePos().y-p.GetPos().y,game->GetWorldMousePos().x-p.GetPos().x);
vf2d pointTowardsMouse={cos(pointMouseDirection),sin(pointMouseDirection)};
float dist=std::clamp(geom2d::line<float>{p.GetPos(),game->GetWorldMousePos()}.length(),0.f,650.f);
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)){
dist--;