2D角色 改變角色朝向

通過2D物體尺寸 x軸乘以-(負號)

void Flip ()
    {
        // Switch the way the player is labelled as facing.轉變朝向標籤
        facingRight = !facingRight;

        // Multiply the player's x local scale by -1.尺寸x軸乘以`-(負號)`
        Vector3 theScale = transform.localScale;
        theScale.x *= -1;
        transform.localScale = theScale;
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章