Forum begins after the advertisement:


[Part 1] Simplifying the flipping character code

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity [Part 1] Simplifying the flipping character code

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #18856
    Terence
    Level 31
    Keymaster
    Helpful?
    Up
    0
    ::

    @blinkachu5275 shares the following on a YouTube comment:

    for the flipping character code, you can simplify it to only 2 lines
    if (xAxis != 0)
        direction = Mathf.CeilToInt(Mathf.Sign(xAxis)); // I created a new int called direction that can only ever be -1 and 1

    this way and then set my transform.localScale to be the new Vector2(direction, transform.localScale.y);

    Way cleaner than a whole if else if statement

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: