Two things:

1) The "intersects" means that the whole sprite rectangle will be checked, so if you want to limit it just to the center you might want to see if, say, the loch/v of the sprite, or maybe the mouseloc interesects some particular sprite

2) Step through it with a debugger. Because you say it always goes to the lower right, I'm guessing that maybe it does snap correctly to the right one, EXCEPT that you never leave the loop, so it might continue on and eventually qualify for the lower right - presuming that's the direction you're going. For instance, put a "return" statement after you set the loc (in the if statement) to kick you out after the first one that qualifies - see how that affects the performance. But this is a good example of where to use the debugger so you can see what's happening. Put a breakpoint (click the mouse on the 'if' statement and then press ctrl-9) on the if statement and run it, and see what happens when you get there.

- Tab


At 08:56 AM 11/22/02, mike m wrote:
hello, i am making a jigsaw game (i am a newbie), i have made a grid for the jigsaw pieces to snap onto, this works, but the pieces seem to snap to whichever grid piece there bottom right corner is in and not the center of the piece, i have checked the registration point and that is in the center of the piece. i am baffled!
this is the code i am using to make the pieces snap to the grid pieces

on snapper

repeat with x = 17 to 32
repeat with y = 1 to 16

if sprite x intersects sprite y then
sprite(x).loc = sprite(y).loc

end if
end repeat
end repeat
end snapper

thanks in advnace :)
Mike



_______________
Mike Malinowski
http://www.raynak.com/~mikesnail/test/index.htm
[EMAIL PROTECTED]




_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus

[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo.  Thanks!]


Reply via email to