Game Development Reference
In-Depth Information
Here are a few examples:
Binary Value: 00 01 00 01 and Decimal Value: 17:
Binary Value: 01 01 01 01 and Decimal Value: 85:
Binary Value: 01 10 10 01 and Decimal Value: 105:
From the ID of a mask instance, we can easily determine what shape the mask is.
This is useful in determining which mask the neighboring piece should be when we
are assigning the mask to each part (piece) of the puzzle image.
The routine that does so is in the jig.game.ShapeGen class. The static gen method
does the picking of mask shapes for each puzzle. We know the size of the image
and how big each piece will be. From this we know how many rows and columns of
pieces we require.
The gen method returns a two-dimensional array, each element containing the shape
object, which will then be used to merge it with the corresponding part of the
puzzle image.
 
Search WWH ::




Custom Search