bearlikelion/Cube3-2btn-Jam

Obstacles don't fit the grid horizontaly

TheRensei opened this issue · 1 comments

  • Obstacles with odd scale will fit when spawned on whole X.
  • Obstacles with even scale will fit when spawned on X + 0.5.

or change scale of all obstacles to even/odd.

Added this to obstacle spawned: ( I don't like it, but I'll leave it for now)

        //Quick fix for obstacles matching the grid
        if (_obstacle.transform.localScale.x % 2 == 0)
        {
            if(wall == "TOP" || wall == "BOTTOM")
            {
                if (xPos >= 0)  xPos += 0.5f;
                else xPos -= 0.5f;
            }
            else
            {
                if (yPos >= 0) yPos += 0.5f;
                else yPos -= 0.5f;
            }
        }