View Full Version : jesse's actionscript movement
I have been messing around with jesse's actionscript movement code, I have a 640x480 screen so I have set the _root:target for _x and _y to 320 and 240 so it will animate to the center. I changed the trigger to be a stationary button in a draggable MC. This all works great. Now I want, when you click on another button, whatever mc is in the center animates back to its starting position as the new one animates to the center.
I have tryed using another blank MC as a reference point for the _x and _y, but I cannot get two MC's to animate at the same time from one button click.
any thoughts?
M-2
Here is what I have done, I think it has something to do with using a variable instead of a target. But I want to have 5 of these that work off of the last one moved.
Main timeline:
one_x = _root.markone._x;
one_y = _root.markone._y;
two_x = _root.marktwo._x;
two_y = _root.marktwo._y;
lastbutton_x = ""
lastbutton_y = ""
button:
on (press) {
_root:lastbutton_x = two_x;
_root:lastbutton_y = two_y;
_root:btarget_x = _root:lastbutton_x;
_root:btarget_y = _root:lastbutton_y;
_root:bxdiv = (_root:btarget_x-_root:lastbutton_x)/20;
_root:bydiv = (_root:btarget_y-_root:lastbutton_y)/20;
if (_root:brunning == true) {
_root.backcontrol:bloops = 0;
}
_root.backcontrol.gotoAndPlay(2);
}
on (release){
_root:target_x = 320;
_root:target_y = 240;
_root:xdiv = (_root:target_x-_root.one._x)/20;
_root:ydiv = (_root:target_y-_root.one._y)/20;
if (_root:running == true) {
_root.controller:loops = 0;
}
_root.controller.gotoAndPlay(2);
}
backcontrol:
frame1
stop ();
bloops = 0;
_root:brunning = false;
frame2
_root:brunning = true;
bloops = bloops+1;
_root:lastbutton_x = _root:lastbutton_x+_root:bxdiv;
_root:lastbutton_y = _root:lastbutton_y+_root:bydiv;
frame3
bloops = bloops+1;
_root:lastbutton_x = _root:lastbutton_x+_root:bxdiv;
_root:lastbutton_y = _root:lastbutton_y+_root:bydiv;
if (bloops < 20) {
gotoAndPlay (2);
} else {
gotoAndPlay (1);
}
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.