The Art of Sumo – Part II

posted in: Senior Team | 0

This week involved finishing off the prototype for our three games and getting feedback from testers. For our puzzle game, I was able to finish of the hammer movement as well as add in some block pushing and matching elements to the prototype.

Movement

Sample movement of the hammer

BlockPushing

Block pushing

When a player moves the hammer to on the sides, they can push blocks across which will allow them to make matches. Logic wise, it starts on the side of the hammer, iterates through each block in the row. If block is pushable, as in not an empty block of a faceblock, then it will push the block onto a stack. When it reaches the end of the row, or an invalid block, it goes back through the stack to shift the color of the block. The last block in the stack grabs the color of the hammer and the hammer gets a new color.

Match

Matching and Clearing

When a column has at least 3 continuous blocks lined up, the play can move the hammer to the top row and activate the column. During this time the rows with the active blocks will be unable to shift until the active blocks clear out. When the active blocks clear out, the columns are adjusted to account for the cleared blocks. This works through the use of queues. When it is time to clear the blocks, it iterates from the bottom of the column, adding the block data of the valid blocks to a queue, once it hits the head block, it breaks out of the loop. It will quickly go back through the loop, grabbing data on the queue. When the queue empties out, the rest of the blocks are set to empty.