PDA

View Full Version : Movie Clip postions


daverbalz
10-10-2001, 01:13 AM
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);
}
}
}
}
}
}
}
}
}
}
}
}
}
}

tg
10-10-2001, 05:28 AM
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.

daverbalz
10-10-2001, 05:43 AM
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.

red penguin
10-10-2001, 08:17 AM
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???
:confused:

daverbalz
10-11-2001, 01:18 AM
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

red penguin
10-11-2001, 12:45 PM
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...
:)

daverbalz
10-12-2001, 02:17 AM
I think I know what you mean now, I'll give it a go.

Thanks