|
As you probably know, I just love jigsaws! So why don't we make one right now? This is how it works ... the player clicks on one piece, then another and the pieces change places. If you think about it, the mechanics are the same as for the Concentration Game so this should be rather easy! The main issue will be ... how do we make the pieces?
We'll need two new BB words: |
Our original image is 640x480 so each of the 12 pieces is 160x160. To create one piece, here's all you do:
img=CreateImage(160,160)
GrabImage is a little trickier because it "grabs" from the current buffer.
In all our work so far this has been the Back Buffer
so we need to make sure the original is already in the Back Buffer.
So you end up with something like this:
...
img=LoadImage("hill_castle.jpg")
DrawBlock img,0,0
piece=CreateImage(160,160)
GrabImage piece,320,160
...
This will set up piece #7.
Ex. 4: Draw piece #7 in the top left corner. My solution.
OK - that should be enough for you to get a basic version going - here's my effort. Get this far and then we'll look at how to improve this program in the next tute.