My way of handling this challenge

Hi all,

I came up with a bit different solution for this lecture, for fliping sprite and movement direction of an enemy. Idea is the same, but code is much shorter and there is no need for creating another function. If there are some disadvantiges, by doing it like I did, please let me know.

    private void OnTriggerExit2D(Collider2D ground)
    {
        moveSpeed = -1 * moveSpeed; //our config for enemy movement line
        transform.localScale = new Vector2(Mathf.Sign(moveSpeed), 1f);
    }

Privacy & Terms