From: Todd Benson Date: 2008-02-15T20:23:47+09:00 Subject: Re: Making an object follow another object - FAIL! On Thu, Feb 14, 2008 at 8:48 PM, Lasse Svensson wrote: > My question is a mathematical one, here we go: > > As you can see here " angle2 = (atan((y2pos-ypos) / > (x2pos-xpos)))/(PI/180)" I determined the angle of the second object by > calculating the angle between the two objects. It works as long as > angle2 is less than 90 or more than 270, but if it gets between there it > breaks away. > > Is there any problems with my math, or is there some other problem > somewhere in the code that makes it behave like that? I'm not going to help with the math, but is there some reason why you don't just keep a position buffer, the length of which (the length of the array) determines the distance between the two sprites? That way, it just follows a path instead of an angle. Todd