I think I have some idea of how to do this relatively simple: Letting each sprite stay at its assigned field and faking the movement:
1) Block A is falling down to the "empty" field below
2) Once it has reached the field, it snaps back, changing to an empty sprite. The sprite assigned to the field below changes from an empty sprite to a block sprite.
I'm not sure if this is how Match Three is usually done, but I think it sounds reasonably logical.
But now I have a small problem. I have placed the blocks in a two-dimensinal array:
blocks[X, Y].spriteID
How do I detect if the mouse pointer is over one of those? I know I can run through each and every one of them and check them individually, but is there a smarter way?
type blockType
spriteID as Integer
orgXpos as Float
orgYpos as Float
status as Integer // EMPTY ORDINARY FALLING SWIPING_UP SWIPING_DOWN SWIPING_LEFT SWIPING_RIGHT SWIPING_BACK_UP SWIPING_BACK_DOWN SWIPING_BACK_LEFT SWIPING_BACK_RIGHT
endtype
global blocks as blockType[BLOCKS_X,BLOCKS_Y]
// Build the blocks
for allX = 1 to BLOCKS_X
for allY = 1 to BLOCKS_Y
blocks[allX, allY].spriteID = CreateSprite(bricksAniImg)
SetSpriteAnimation ( blocks[allX, allY].spriteID, BLOCK_WIDTH, BLOCK_WIDTH, 6 )
SetSpriteFrame ( blocks[allX, allY].spriteID, random(1, GetSpriteFrameCount(blocks[allX, allY].spriteID)) )
blocks[allX, allY].status = ORDINARY
blocks[allX, allY].orgXpos = GetSpriteX( blocks[allX, allY].spriteID )
blocks[allX, allY].orgYpos = GetSpriteY( blocks[allX, allY].spriteID )
SetSpritePosition ( blocks[allX, allY].spriteID, (allX-1)*BLOCK_WIDTH, (allY-1)*BLOCK_WIDTH)
next
next