From 3c07d91ec84d73b0010d34d59d15672ff2ee9955 Mon Sep 17 00:00:00 2001 From: ProtoSharkk Date: Fri, 25 Oct 2024 14:02:48 -0700 Subject: [PATCH] Swing in correct direction --- Assets/C# Scripts/Teo.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/C# Scripts/Teo.cs b/Assets/C# Scripts/Teo.cs index 2abcc9c..c8194a2 100644 --- a/Assets/C# Scripts/Teo.cs +++ b/Assets/C# Scripts/Teo.cs @@ -58,11 +58,11 @@ public class Teo : MonoBehaviour // If ratbot exists and is within swing range, damage it. // Calculate absolute difference between angles of ratbot and cursor if (ratbot == null || Mathf.Abs(Mathf.Atan2( - ratbot.transform.position.y - transform.position.y, - ratbot.transform.position.x - transform.position.x + hit.transform.position.y - transform.position.y, + hit.transform.position.x - transform.position.x ) - Mathf.Atan2( - Screen.height/2 - Input.mousePosition.y, - Screen.width/2 - Input.mousePosition.x + Input.mousePosition.y - Screen.height/2, + Input.mousePosition.x - Screen.width/2 )) > swingRangeDeg * Mathf.Deg2Rad ) continue; ratbot.Damage(damageStrength);