Hi, I am now trying to write a mini game like "Dr. Robotnik's Mean Bean Machine" or "Diamond" tetris-liked puzzle game.
I am now struggling on how to detect if the blocks of the same type are connected in an efficiency way.
Followings are what i have done:
1. When the blocks cannot drop further, the sprite will be replaced by a background pattern.
2. The layer of the blocks represented by the background pattern set to $01
Therefore, once the sprite cannot drop further and turned to background. I will check if the background pattern of the neighbour block is the same.
If yes, then the neighbours of the "checked-neighbour" will be checked... until no more blocks with the same background pattern.
During the checking, a counter will log the number of the blocks with the same background pattern are connected together. Once the number of connected blocks are more than or equal to 4, cancellation will be processed.
However, I do think that the method I described in the above is not efficient ...
Is anyone can give me some hints?
Regards,
Sunny
I am now struggling on how to detect if the blocks of the same type are connected in an efficiency way.
Followings are what i have done:
1. When the blocks cannot drop further, the sprite will be replaced by a background pattern.
2. The layer of the blocks represented by the background pattern set to $01
Therefore, once the sprite cannot drop further and turned to background. I will check if the background pattern of the neighbour block is the same.
If yes, then the neighbours of the "checked-neighbour" will be checked... until no more blocks with the same background pattern.
During the checking, a counter will log the number of the blocks with the same background pattern are connected together. Once the number of connected blocks are more than or equal to 4, cancellation will be processed.
However, I do think that the method I described in the above is not efficient ...
Is anyone can give me some hints?
Regards,
Sunny