Why is it that when creating the left and right children, you're assigning them all identical X positions? If you're splitting horizontally, I'm struggling to understand why the algorithm would assign the same x position to both children. Would they not be overlapping?
if (splitH)
{
leftChild = new Leaf(x, y, width, split);
rightChild = new Leaf(x, y + split, width, height - split);
}
else
{
leftChild = new Leaf(x, y, split, height);
rightChild = new Leaf(x + split, y, width - split, height);
}
Why is it that when creating the left and right children, you're assigning them all identical X positions? If you're splitting horizontally, I'm struggling to understand why the algorithm would assign the same x position to both children. Would they not be overlapping?
https://github.com/tutsplus/Using-BSP-Trees-to-Generate-Game-Maps/blob/master/src/Leaf.as#L54