Closed np-eazy closed 1 year ago
Actually it is a better game design choice to have TargetBlocks start of at 3x3.
At the rate they are spawning, the TargetBlocks in this commit are too difficult for a normal game. The point of this issue was just to get the logic in though, and we can always change the parameters and tweak the rules/logic in another ticket focused on the game design per se.
A TargetBlock is a square-shaped group of cells at some center location, which must be filled before it grows too large.
x0
: x upper lefty0
: y upper leftx1
: x lower righty1
: y lower rightiterations
: number of block placements this TargetBlock has livediterationsToGrowth
: number of iterations left until the next time it growsticks
: number of ticks this TargetBlock has livednew TargetBlock(x0, y0, x1, y1)
: A TargetBlock starts at size 2x2, but has the option to start at whatever size. Don't spawn within 2 blocks of the edge.checkClear()
: A TargetBlock is cleared when all the blocks inside it are solid.grow()
: Every 4N block placements, the TargetBlock grows by moving x0, y0 up and left, and x1, y1 down and right. N starts at 1 and goes up by 0.5checkGameOver()
: If x0, y0 or x1, y1 ever leave the game bounds, we can trigger a gameOver flag