b3ta.com board
You are not logged in. Login or Signup
Home » Messageboard » XXX » Message 2828358 (Thread)

# err
its possible you could find some movement script and adapt it to your needs, such as making it move at a certain speed to a certain point
(, Wed 3 Mar 2004, 16:09, archived)
# i have been using this tutorial:
www.wildform.com/tutorials/draganddrop/?sid=P3OP-NLEP-3fc088299622d&ref=

which has the smooth-bit included - however it no longer works when i set it up for multiple targets (as we discussed last night)

I can't see where i'm going wrong so just wondered if you knew what the relevant section was..


this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;


i assumed it was the "/5" part, but if i include that, the drag just moves a small (1/5?) distance towards the target - without it it snaps in one frame
(, Wed 3 Mar 2004, 16:13, archived)
#
this._x -= (this._x-this.myFinalX)/5;

this._y -= (this._y-this.myFinalY)/5;

so it takes the current position takes off your final xy each time, try putting /5 in the () or spaces somewhere

or perhaps you need an onclipevent(enterframe) {
this._x -= (this._x-this.myFinalX)/5;

this._y -= (this._y-this.myFinalY)/5;
}

because then it will move slowly back, /5 should be the speed. You might need an if clause to stop it though so it doesn't use up cpu power when still doing that equation
(, Wed 3 Mar 2004, 16:22, archived)
# right..
i think i get it - i will have a bit more of a fiddle ;)

cheers again!
(, Wed 3 Mar 2004, 16:31, archived)
# no trouble
*doffs hat*
(, Wed 3 Mar 2004, 16:33, archived)
# if you use that
it will never actually get to its target (thoertically)
although I like your logic.
I also like flash mx
(, Wed 3 Mar 2004, 16:22, archived)
# 1/5 is right
you just need to keep doing it until you are close enough, so in the next frame put a gotoandplay back to this frame.

This causes it to loop forever, so in this frame, you need to check if it's as near as dammnit to where it should be, along the lines of

if abs(this._x-this.myFinalX)
(, Wed 3 Mar 2004, 16:37, archived)