| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Oct 2001
Location: California
Posts: 14
|
I'm making a sliding puzzle, and I want Flash to recognize when the puzzle is complete. The puzzle works but my code to recognize the completion of the puzzle doesn't. The way I wrote the code was for Flash to see if the MC were in the correct postion in relation to one another. Here is what I have, any suggestions will be appreciated:
if (_root[tile1].y=_root[tile2].y=_root[tile3].y=_root[tile4].y) { if (_root[tile5].y=_root[tile6].y=_root[tile7].y=_root[tile8].y) { if (_root[tile9].y=_root[tile10].y=_root[tile11].y=_root[tile12].y) { if (_root[tile13].y=_root[tile14].y=_root[tile15].y) { if (_root[ile1].y<_root[tile5].y) { if (_root[tile5].y<_root[tile9].y) { if (_root[tile9].y<_root[tile13].y) { if (_root[tile1].x=_root[tile5].x=_root[tile9].x=_root[tile13].y) { if (_root[tile2].x=_root[tile6].x=_root[tile10].x=_root[tile14].y) { if (_root[tile3].x=_root[tile7].x=_root[tile11].x=_root[tile15].y) { if (_root[tile4].x=_root[tile8].x=_root[tile12].x) { if (_root[tile1].x<_root[tile2].x) { if (_root[tile2].x<_root[tile3].x) { if (_root[tile3].x<_root[tile4].x) { gotoAndStop (2); } } } } } } } } } } } } } } Last edited by daverbalz; 10-12-2001 at 03:17 AM.. |
|
|
|
|
|
#2 |
|
done
Join Date: Jun 2001
Location: portland, or
Posts: 8,048
|
your code seems a bit over kill just to see if the puzzle is complete. why not have a total_count for all pieces in the puzzle and every time some puts a piece in correctly you just decriment the count if total_count==0 then the puzzle is done.
__________________
tg --- what the hell was i thinking? |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Oct 2001
Location: California
Posts: 14
|
I don't believe I can use the total_count method becuse it isn't a jigsaw type puzzle. It's a sliding puzzle (all piece exist in a 4 x 4 gird with one open slot), so when a piece is in the right spot, it will have to be moved again until the total puzzle is complete.
Don't know if I'm explaing myself clearly. |
|
|
|
|
|
#4 |
|
[^\d\D]
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,253
|
How about if a tile is put in it's proper position, you increment a variable which at the beginning would be 0. If said var is == 15, if it's a number style puzzle, then we know we are done???
![]() |
|
|
|
|
|
#5 |
|
Registered User
Join Date: Oct 2001
Location: California
Posts: 14
|
Actually its a picture puzzle so I don't think the number variables will work, but i'll give it a go.
Here is a look at what i'm after: http://gettosake.com/theater/astroslide.html |
|
|
|
|
|
#6 |
|
[^\d\D]
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,253
|
Shouldn't matter at all, I should think...Of course this is just a suggestion...What I'm thinking is that you can increase a certain var when the piece is in it's proper position. Else, decrease it...If you've got the var == 15(or whatever the number of tiles), flash knows they are all in position.
Make sense? In my head it does. Now, how that gets down in code...How about a function to check? Pieces in an array...blah, blah... ![]() |
|
|
|
|
|
#7 |
|
Registered User
Join Date: Oct 2001
Location: California
Posts: 14
|
I think I know what you mean now, I'll give it a go.
Thanks |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| scrolling slide show movie clip not working after is placed on the stage | nikita26 | ActionScript 2.0 | 2 | 08-02-2004 04:55 PM |
| scrolling slide show movie clip not working after is placed on the stage | nikita26 | ActionScript 2.0 | 2 | 07-30-2004 11:16 PM |
| movie clip control | Kingman | ActionScript 1.0 (and below) | 2 | 06-13-2003 03:23 PM |
| Looping in a Movie Clip... | HotZone2156 | ActionScript 1.0 (and below) | 10 | 10-24-2001 08:27 PM |