Jigsaw puzzle_2

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Jigsaw puzzle_2

Postby mercedes » Sat Jan 23, 2010 7:54 am

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;
piece1selected
piece2selected
change1
change2

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
change1=0
change2=0
piece1selected=0
piece2selected=0
check_pieces
End Sub


Code: Select all
sub piece_selecting

If piece1selected=0 Then
piece1selected=1
change1=GetHotspotNumber

ElseIf  piece1selected=1 Then
piece2selected=1
change2=GetHotspotNumber
change_pictures
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
piece1=1
Else
piece1=0
End If


If check_hs2x=444 and check_hs2y=308 Then
piece2=1
Else
piece2=0
End If


If check_hs3x=546 and check_hs3y=308 Then
piece3=1
Else
piece3=0
End If


If check_hs4x=342 and check_hs4y=409 Then
piece4=1
Else
piece4=0
End If


If check_hs5x=443 and check_hs5y=409 Then
piece5=1
Else
piece5=0
End If


If check_hs6x=546 and check_hs6y=409 Then
piece6=1
Else
piece6=0
End If


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

End Sub


I hope I didn't miss anything..Please let me know..and again Thanks Juhu!~ :D
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby reneuend » Sat Jan 23, 2010 8:51 am

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.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2689
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby mercedes » Sat Jan 23, 2010 9:12 am

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 one..you can't tell u clicked a piece..you 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 piece..to 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 placed..it 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..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby juhuwoorps » Sat Jan 23, 2010 1:05 pm

@reneuend:
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.

@mercedes:
For the block one: I think I have an idea to do this.I'm going to check it out this evening.
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby reneuend » Sat Jan 23, 2010 3:56 pm

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.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2689
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby juhuwoorps » Sun Jan 24, 2010 10:58 am

Can you make a short tutorial for this?
I'm not sure how it should work. I never have worked with comma-delimited lists.
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby reneuend » Sun Jan 24, 2010 5:36 pm

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.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2689
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby mercedes » Wed Jun 01, 2011 6:46 am

*Sorry for bumping post Candle*

Juhu...

***
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 late..lol
Last edited by mercedes on Wed Jun 01, 2011 11:28 pm, edited 1 time in total.
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby reneuend » Wed Jun 01, 2011 12:53 pm

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 helps...like 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!
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2689
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby Vengeance66 » Wed Oct 19, 2011 6:54 pm

Is there example for this tutorial?

Thanks :)
Stay a while and listen...

Rainbow Enterainment - http://rainbowenter.com/
User avatar
Vengeance66
Administrator
 
Posts: 630
Joined: Wed Oct 13, 2010 2:17 pm
Location: Macedonia


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron