I’m following this tut Match-3 . And I’m trying to rewrite function handleClick (in GameArea.qml) as my algorithm:
function handleClick(row, column, type) {
// // copy current field, allows us to change the array without modifying the real game field
// // this simplifies the algorithms to search for connected blocks and their removal
// var fieldCopy = field.slice()
// // count and delete connected blocks
// var blockCount = getNumberOfConnectedBlocks(fieldCopy, row, column, type)
// if(blockCount >= 3) {
// removeConnectedBlocks(fieldCopy)
// }
burn(row, column, type, 1)
}
function burn(row, column, type, count) {
if(count > 2) {
var block = field[index(row, column)]
if(block !== null) {
field[index(row, column)] = null
entityManager.removeEntityById(block.entityId)
}
count = burn(row + 1, column, type, count + 1)
count = burn(row - 1, column, type, count)
count = burn(row, column + 1, type, count)
return burn(row, column - 1, type, count)
}
var blockNext = field[index(row + 1, column)]
if((block !== null) && (block.type === type))
count = burn(row + 1, column, type, count + 1)
blockNext = field[index(row - 1, column)]
if(block !== null && block.type === type)
count = burn(row - 1, column, type, count + 1)
blockNext = field[index(row, column - 1)]
if(block !== null && block.type === type)
count = burn(row, column - 1, type, count + 1)
blockNext = field[index(row, column + 1)]
if(block !== null && block.type === type)
count = burn(row, column + 1, type, count + 1)
if(count > 2) {
var blockThis = field[index(row, column)]
if(blockThis !== null) {
field[index(row, column)] = null
entityManager.removeEntityById(block.entityId)
}
}
return count
}
I ran the app but it didn’t work. So I debug the code, I put the break point at line:
var blockNext = field[index(row + 1, column)]
if((block !== null) && (block.type === type))
count = burn(row + 1, column, type, count + 1)
then press F5 and F10 few times. The debug pointer points to above lines only. I cannot see the pointer points to followed lines. How can I debug this JavaScript code in Qt Creator?