|
-
Who needs pants?
Move to point
I posted this in the pyhsics forum but ill post it here to 
How do i move a mc to a specific point from any ponit on the stage.
That i want to for the mc to move at the same speed to the destination ?
i know how to make it ease in but thats not what i want. What i want is to move at a steady speed.
FOR EASING: i used this
targetx = 0;
targety = 400;
_x += (targetx - _x)/speed;
_y += (targety - _y)/speed;
That eases into the position. What i want is to move at say a speed of 5.
-
Senior Member
Maybe:
if (targetx<_x){
_x-=speed;
}
if (targetx>_x){
_x+=speed;
}
and same for y coord.
-
Who needs pants?
Thanks Tonypa, Im going to stick to the easing because in the long run it looks smoother but thanks heaps
-
383,890,620 polygons
why not use both?
for couldron i used something like
PHP Code:
var VelX = (targetx - _x)/speed;
var VelY = (targety - _y)/speed;
_x += (VelX > MaxVel) ? MaxVel : VelX;
_y += (VelY > MaxVel) ? MaxVel : VelY;
so if you set a MaxVel of 5 it would move at a max speed of 5 and when it comes closer to the target it will slow down.
<olli/>
-
Double post...
Last edited by mastermute; 01-29-2003 at 09:38 AM.
The future is no longer what it used to be...
-
Originally posted by nGFX
why not use both?
var VelX = (targetx - _x)/speed;
<snip/>
so if you set a MaxVel of 5 it would move at a max speed of 5 and when it comes closer to the target it will slow down.
Nice! I'm gonna hang out in these threads!
The future is no longer what it used to be...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|