15 March 2010 [Monday] @ March 15, 2010 edit
Moving object problemif(pass._x > x && pass._y < y)
{ang = Math.atan2(y-pass._y, x- pass._x);
if (pass._x > x)
{
pass._x += Math.cos(ang)*spe/15;
pass._y += Math.sin(ang)*spe/15;
}
}
else if (pass._x < x && pass._y < y)
{ang = Math.atan2(y-pass._y, x - pass._x);
if (pass._x < x)
{
pass._x += Math.cos(ang)*spe/15;
pass._y += Math.sin(ang)*spe/15;
}
}
when the x is negative value and y is positive value it work (move to bottom left), when x is positive value and y is positive value, it didnt work , (should move to bottom right). any idea?? thanks
#If you have any other info about this subject , Please add it free.# |
| More »