Note About This Book: Advanced Lingo For Games was written by Gary Rosenzweig in 2000 for users of Macromedia Director 7. It is presented here for free on an as-is basis, with no updating. Most of the information and code here can be used in the most recent version of Director. The book has been reproduced from the final editing files archived in 2000, and not the final proof galleys. So some minor differences between this version and the printed version my exist. The entire contents of this book are Copyright 2000, Gary Rosenzweig. No part may be reproduced or copied without written permission. The text here is provided for individual use only.
Want to thank me for making this book available for free? Just buy Special Edition Using Macromedia Director MX and we'll call it even!

Advanced Lingo For Games
by Gary Rosenzweig


Chapter 5 Section 4

Game Variations

You can add the most variety to your jigsaw puzzles through the images themselves. You can make difficult puzzles that use images with repeating patterns, like a field of grass, or simple puzzles that have distinct objects in the image.

However, there are a few other features you can add to this game. You can allow the player to examine the complete image from time to time, just as jigsaw puzzle players sometimes look at the box to see where pieces go. You can also create non-rectangular puzzles.

Looking at the Box

It's a good idea to allow the player to glimpse the entire puzzle from time to time to get a hint as to where pieces go. One simple way to do this is to place a small button on the Stage that the user can click to see the image. The image will only appear until the user lifts up the mouse button.

A behavior to do this is very simple. It just swaps out the button sprite's member for the member in the next Cast slot. As soon as the mouse button is lifted, the sprite reverts back to the button member.


property pOrigMemberNumber

on beginSprite me
  -- remember the original member
  pOrigMemberNumber = sprite(me.spriteNum).memberNum
end

on mouseDown me
  --show the next member
  sprite(me.spriteNum).memberNum = pOrigMemberNumber+1
end

on mouseUp me
  -- revert back to original member
  sprite(me.spriteNum).memberNum = pOrigMemberNumber
end

on mouseUpOutside me
  mouseUp(me)
end

Check out how this is done in the example movie on the CD-ROM. The button and the complete image are in Cast members right next to each other. Also, their registration points are set so that if the button is in the lower-left corner of the Stage, the image also appears there. You can play with the button's Stage position and the two members' registration points to have them appear anywhere on the Stage.

For the image to appear on top of any pieces on the Stage, the button should be in a higher-numbered sprite channel than the pieces.

You may also want to place the completed image on the Ògame overÓ screen for the player to look at. This is much nicer than simply jumping to mostly-blank frame as the example movie does.

Different Puzzle Shapes

The code in this chapter will work regardless of the shape of the puzzle. It just uses the registration points of the pieces and their rectangles to determine which pieces link to which. So you could create a circular image, for instance, and then cut pieces out of that.