kubowania/candy-crush

moveDown should be repeated until no more moves BEFORE rescecking for matches

Opened this issue · 1 comments

Please check following scenario :
image

hey im pretty new to git hub but i did come up with a method to fix this i believe

when you initiate the board originally do all the checkrow and column functions to set it up then follow up with a function that runs a loop checking for any empty squares in the grid. if theres empty squares run the moveDown function untill every square has a color THEN check matches again and repeat

function run() {

setInterval(function() {
	
	if (tiles.some(tile => tile.style.backgroundColor === '')) {
	moveDown()
	} else {
		checkRowFour()
		checkColumnFour()
		checkRowThree()
		checkColumnThree()
	}
}
	, 100)

}

start this function directly after the check methods