The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 2 of 2

Thread: Position of a puzzle piece in Flash Jigsaw puzzle

Hybrid View

  1. #1

    Position of a puzzle piece in Flash Jigsaw puzzle

    I have a 4*4 grid. I have 16 MovieClips scattered around the grid. Each MovieClip is 40*40 and they are draggable. The user can drag and drop the MovieClips into the grid. Each clip has a correct position. For example for
    clip 0 : x=0 , y=0
    clip 1 : x=40, y=0
    clip 2 : x=120 , y=0
    clip 3 : x=160 , y=0
    clip 15 : x=160 , y=160
    The game finishes when all the clips are in correct position. So its easy to check for game over. Use a loop and ENTER_FRAME to monitor the positions of all clips.
    There is a small problem I cannot solve. When the user drags a clip it will snap to position in the grid whether it is correct or not. The snappable positions will be multiples of 40 in this case. It is possible for two clips to snapped to a location and this has to be avoided. If I have put a clip at (40,120) I should not be able drop another MovieClip there. In effect I should be able to get some indication telling me that this position is occupied.
    Using the indication I will make the MovieClip return to original position.
    How can this can be achieved. The registration points of MovieClips are topleft.

  2. #2
    You can use arrays to store a 1 or 0 if that place is occupied or not. When its 0 then the slot is empty, when 1 then its already placed. When that placed piece is moved again that position is set to 0 again kind of thing.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012