Midget
03-12-2007, 01:20 PM
i'm trying to make a jigsaw puzzle for my crap uni project where the pieces will snap into place when close to their correct position
this is the actionscript i've got on the piece
on (press) {
startDrag("p1");
}
on (release) {
stopDrag();
if (p1._x>25 && p1._x<65 && p1._y>105 && p1._y<145)
p1._x = 45;
p1._y = 125;
}
(p1 is the instance name of the piece if you couldn't tell, and x=45, y=125 is the correct position of it)
now the y snapping works fine, if you put the piece within 20 pixels of it's position it will snap into it's y position perfectly
however, the x snapping is messed up, it snaps into it's x position regardless of where you place it on the board
the compiler doesn't give any errors when i test the actionscript, so i don't understand what's happening
it's here (http://img514.imageshack.us/my.php?image=projectgs4.swf) if you want to have a look (go to games > jigsaw puzzle... only the first piece has any actionscript on it so far btw, so the others won't do anything)
i know it's crap but it's all my course expects of me :/ (it obviously isn't finished either)
any help appreciated :)
this is the actionscript i've got on the piece
on (press) {
startDrag("p1");
}
on (release) {
stopDrag();
if (p1._x>25 && p1._x<65 && p1._y>105 && p1._y<145)
p1._x = 45;
p1._y = 125;
}
(p1 is the instance name of the piece if you couldn't tell, and x=45, y=125 is the correct position of it)
now the y snapping works fine, if you put the piece within 20 pixels of it's position it will snap into it's y position perfectly
however, the x snapping is messed up, it snaps into it's x position regardless of where you place it on the board
the compiler doesn't give any errors when i test the actionscript, so i don't understand what's happening
it's here (http://img514.imageshack.us/my.php?image=projectgs4.swf) if you want to have a look (go to games > jigsaw puzzle... only the first piece has any actionscript on it so far btw, so the others won't do anything)
i know it's crap but it's all my course expects of me :/ (it obviously isn't finished either)
any help appreciated :)