Page 1 of 1

Jigsaw puzzle_2

PostPosted: Sat Jan 23, 2010 7:54 am
by mercedes
Another form of jigsaw puzzle..[ Thanks Juhu!~]

Ok, I hope i translate this right..if not let me know..The hotspot coordinates would be according to your project, you would change these as u wanted..

This puzzle is designed so u can put a picture together, all square pieces. It would look somewhat like a slider. Only you click one picture, then another, and they exchange places. This puzzle is similar to what u see in most Nancy Drew games..MCF games..ect..

This is for 6 pieces, anymore and u would have to add to the subroutines.

Variables needed;

In the Advanced tab of each puzzle piece. Call the subroutine piece_selecting

You need 3 Sub Routines

Code: Select all
Sub change_pictures
ypos1 = Hotspot(change1).Top/15
xpos1 = Hotspot(change1).Left/15
ypos2 = Hotspot(change2).top/15
xpos2 = Hotspot(change2).left/15
Hotspot(change1).Move xpos2*15,ypos2*15
Hotspot(change2).Move xpos1*15,ypos1*15
End Sub

Code: Select all
sub piece_selecting

If piece1selected=0 Then

ElseIf  piece1selected=1 Then
End If
End Sub

Code: Select all
sub check_pieces
check_hs1x = Hotspot(1).Left/15
check_hs1y = Hotspot(1).Top/15

check_hs2x = Hotspot(2).Left/15
check_hs2y = Hotspot(2).Top/15

check_hs3x = Hotspot(3).Left/15
check_hs3y = Hotspot(3).Top/15

check_hs4x = Hotspot(4).Left/15
check_hs4y = Hotspot(4).Top/15

check_hs5x = Hotspot(5).Left/15
check_hs5y = Hotspot(5).Top/15

check_hs6x = Hotspot(6).Left/15
check_hs6y = Hotspot(6).Top/15

If check_hs1x=342 and check_hs1y=308 Then
End If

If check_hs2x=444 and check_hs2y=308 Then
End If

If check_hs3x=546 and check_hs3y=308 Then
End If

If check_hs4x=342 and check_hs4y=409 Then
End If

If check_hs5x=443 and check_hs5y=409 Then
End If

If check_hs6x=546 and check_hs6y=409 Then
End If

If piece1=1 and piece2=1 and piece3=1 and piece4=1 and piece5=1 and piece6=1 Then
End If

End Sub

I hope I didn't miss anything..Please let me know..and again Thanks Juhu!~ :D

PostPosted: Sat Jan 23, 2010 8:51 am
by reneuend
Interesting! Nice solution! :)

In my puzzle, I didn't move the hotspots around, just the image in the hotspot.

When the user selects a puzzle piece, I put a border around the hotspot, then when the user selects the next piece, the border is gone, the images are swapped and I check to see if the puzzle is solved. If not, then when the user selects the next puzzle piece I start all over.

PostPosted: Sat Jan 23, 2010 9:12 am
by mercedes
In my puzzle, I didn't move the hotspots around, just the image in the hotspot.

The pieces don't move around either in this one..they exchange places..Or do u mean Keygaurd?..where u can move them from upside right..ect..?

What I would like to add to this one....I like the idea of a border..
With this can't tell u clicked a simply click a piece and then click another--they exchange places..

I would love to see the demo u have too ..cause I like the idea of a border..This way the user knows they clicked that hotspot/picture..

When the user selects a puzzle piece, I put a border around the hotspot, then when the user selects the next piece, the border is gone, the images are swapped.

Does the border appear on the other let u know u have selected it to swap with..?

and I check to see if the puzzle is solved. If not, then when the user selects the next puzzle piece I start all over

I don't understand...Are u saying that if the piece isn't correctly goes back..and the user has the option to click the "right" piece..Basically they keep going back till the user selects the right piece for the right place..?

Thanks so much for reply..Please post your tut!~...I really want to see it...:D..The option to turn pieces would be neat too..Something that could be added later..cause i like that idea alot..

On another note;

When I mentioned the blocks one..did that sound familiar to u..?..I know u have tried some ND games..which is why i asked..

PostPosted: Sat Jan 23, 2010 1:05 pm
by juhuwoorps
How do you check if the right picture is on the right hotspot loaded?

As I made this, first I want to change only the pictures but I'm stuck how to check if the picture has loaded the right image.

For the block one: I think I have an idea to do this.I'm going to check it out this evening.

PostPosted: Sat Jan 23, 2010 3:56 pm
by reneuend
I created 2 comma-delimited lists.
The first one contains the correct order of hotspot indexes.
The second contains the randomized order of hotspot indexes.

Here is the trick. The image names are sequential: img1.jpg, img2.jpg....
The numbers coorespond to the hotspot indexes that they should belong too. So, I just use the index numbers to determine what image I have.

PostPosted: Sun Jan 24, 2010 10:58 am
by juhuwoorps
Can you make a short tutorial for this?
I'm not sure how it should work. I never have worked with comma-delimited lists.

PostPosted: Sun Jan 24, 2010 5:36 pm
by reneuend
you haven't tried delimited lists! You'll love them! It's a great alternative to global arrays!

I have a tutorial on lists in the tutorial area, but I think I called it global arrays. It includes several functions that allows you to do almost anything with a list.

I'll see what I can put together. My puzzle code is a bit bloated.

PostPosted: Wed Jun 01, 2011 6:46 am
by mercedes
*Sorry for bumping post Candle*


I made the mistake of putting the code together, and the hs's and coordinates were in order when i did it..

The HS's pictures were not mixed up when I did the procedures..and input coordinates..-:cry: :cry:

I took for granted that the picture/puzzle should look solved..for the coordinates....
I lined them up 1-16...with the pictures matching the HS numbers.

Then I mixed up the tiles..


Is there any way to fix it... so that..
It will work mixing the tiles up...any way..

This way as long as HS(1) ends up where HS(1) should be..and you can mix up the tiles any which way on the frame..

Does this make any sense..? Sorry if it doesn't... I'm really tired and it's super

PostPosted: Wed Jun 01, 2011 12:53 pm
by reneuend
Hi Mercedes,

Without taking the time to look at your code (I'm at work and need to get started), I think you can create a variable for each hotspot that will act as the hotspot's index in the puzzle. I did this in the Key Sequence puzzle for the very reason that got you. I didn't want to rely on the hotspot index. I believe I called it "keynum" and I set it's index at the top of each hotspot advanced tab.

I hope this I said I'm at work and don't have time to look at the code right now.

PM me if you still need help!

PostPosted: Wed Oct 19, 2011 6:54 pm
by Vengeance66
Is there example for this tutorial?

Thanks :)