Here is what you will need..
KeyGuard --For Key up and Key down feature--102 & 103 are the KeyID's
An icon made of each picture; Name them piece1 piece2 etc.
Pictures of the puzzle pieces as GIF's Name the pieces piece_1, piece_2..etc..
First place all pictures on the Left side of the frame and place pictures accordingly so they look together..
Also make sure they go from 1-21 or whatever number they end at..--Then make them TRansparent
Place the "actual" pictures in their place on the right side of frame.
Here's a picture of it..You don't have to download it..Just give it a second..
PictureHere
For the puzzle pieces on the Right.[the ones u see] Place this in the Advance of hotspot
puzzlehotspot=Action.GetHotspotNumber
Put an EXIT button on the frame also..
Variables puzzleready piececorrect and puzzlehotspot
Then place this in the Global Procedures..
- Code: Select all
Sub KeyGuard_MouseButtonPressed(KeyID)
numberofpuzzlepieces=21'--Make sure this is the amount of yours.'
Dim XPos, YPos
Select Case KeyID(0)
Case 102
XPos = Cint(Component("KeyGuard").Object.MouseXPos)
YPos = Cint(Component("KeyGuard").Object.MouseYPos)
If puzzlehotspot>numberofpuzzlepieces Then
Hotspot(puzzlehotspot).Move -300*15,-300*15
piecename="piece" & puzzlehotspot-numberofpuzzlepieces &".ico"
Action.ChangeDefaultCursor piecename
End If
Case 103
XPos = Cint(Component("KeyGuard").Object.MouseXPos)
YPos = Cint(Component("KeyGuard").Object.MouseYPos)
If XPos<=0 or XPos>=800 or YPos<=0 or Ypos >=715 Then
Action.ChangeDefaultCursor ""
Hotspot(puzzlehotspot).Move 400*15,350*15
Exit Sub
End If
'----------------------------------
If puzzlehotspot>numberofpuzzlepieces Then
Action.ChangeDefaultCursor ""
Hotspot(puzzlehotspot).Move XPos*15,YPos*15
hotspottop=(Hotspot((puzzlehotspot-numberofpuzzlepieces)).Top)/15
hotspotleft=(Hotspot((puzzlehotspot-numberofpuzzlepieces)).Left)/15
hotspotwidth=(Hotspot((puzzlehotspot-numberofpuzzlepieces)).width)/15
hotspotheight=(Hotspot((puzzlehotspot-numberofpuzzlepieces)).height)/15
puzzlepiecename="piece_" & (puzzlehotspot-numberofpuzzlepieces) & ".gif"
If XPos>hotspotleft and XPos<(hotspotleft+hotspotwidth) and YPos>hotspottop and YPos<(hotspottop+hotspotwidth) Then
PlaySound GetPath(2)+"cheng.mp3",False
Action.LoadAPicture Hotspot((puzzlehotspot-numberofpuzzlepieces)),puzzlepiecename
Hotspot(puzzlehotspot).Move -300*15,-300*15
piececorrect=piececorrect+1
If piececorrect=numberofpuzzlepieces Then
puzzleready=1
End If
End If
puzzlehotspot=0
End If
End Select
End Sub
In the Exit button make sure that picture isn't visible till PuzzleReady =1
Make sure you have the Sound Script in the Procedures with this..
Change the number of pieces to suit your project, mine happen to be 21..~
Also the peice to be found don't have to be in the inventory..The user can simply find what looks like ripped paper and be taken to this screen to complete it..Up to u how u do it..
I hope i didn't forget anything..~
Again Thanks to those who made this happen..Juhu Lyberodoggy..and of course ShadowHunter for Keyguard..
Enjoy!~