From d6f204806d1a3741922cc78972b9ce22eb460ceb Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 6 May 2023 21:00:15 -0700 Subject: [PATCH] testing why enemies jittering --- Assets/Scripts/EnemyPatrol.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/EnemyPatrol.cs b/Assets/Scripts/EnemyPatrol.cs index ad091cc..5a84dbc 100644 --- a/Assets/Scripts/EnemyPatrol.cs +++ b/Assets/Scripts/EnemyPatrol.cs @@ -47,7 +47,13 @@ public class EnemyPatrol : MonoBehaviour { void Update() { if (!pinned) { if (isHorizontal) { - if (transform.position.x > xRight || transform.position.x < xLeft) { + if (transform.position.x >= xRight || transform.position.x <= xLeft) { + if (transform.position.x >= xRight) { + print(this.gameObject.name + "hit right limit"); + } + if (transform.position.x <= xLeft) { + print(this.gameObject.name + "hit right limit"); + } movementVectorHorizontal = -movementVectorHorizontal; GetComponent().flipX = !GetComponent().flipX; }