testing why enemies jittering
This commit is contained in:
@@ -47,7 +47,13 @@ public class EnemyPatrol : MonoBehaviour {
|
|||||||
void Update() {
|
void Update() {
|
||||||
if (!pinned) {
|
if (!pinned) {
|
||||||
if (isHorizontal) {
|
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;
|
movementVectorHorizontal = -movementVectorHorizontal;
|
||||||
GetComponent<SpriteRenderer>().flipX = !GetComponent<SpriteRenderer>().flipX;
|
GetComponent<SpriteRenderer>().flipX = !GetComponent<SpriteRenderer>().flipX;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user