From 80e63019edb8e8bcbff0eb32361c8cd78c1cc856 Mon Sep 17 00:00:00 2001 From: ProtoSharkk Date: Tue, 22 Oct 2024 12:47:43 -0700 Subject: [PATCH] Rework attack to properly use swingRange and swingDistance --- Assets/Player.prefab | 1 + Assets/Teo.cs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/Player.prefab b/Assets/Player.prefab index 1217bb3..dc7e746 100644 --- a/Assets/Player.prefab +++ b/Assets/Player.prefab @@ -114,6 +114,7 @@ MonoBehaviour: dashCooldownSeconds: 5 lastAttackTime: 0 lastDashTime: 0 + distanceIndicator: {fileID: 0} --- !u!50 &-4152331571693237436 Rigidbody2D: serializedVersion: 5 diff --git a/Assets/Teo.cs b/Assets/Teo.cs index 5feb6b1..8f8ae67 100644 --- a/Assets/Teo.cs +++ b/Assets/Teo.cs @@ -51,9 +51,10 @@ public class Teo : MonoBehaviour transform.position, swingRange, new Vector2( - Screen.width/2 - Input.mousePosition.x, - Screen.height/2 - Input.mousePosition.y - ) + Input.mousePosition.x - Screen.width/2, + Input.mousePosition.y - Screen.height/2 + ).normalized, + swingDistance ); // Damage all ratbots in scanned area foreach (RaycastHit2D hit in hits) {