-(void) setShotDirection
{
CGPoint v;
float xm;
float ym;
float magnitude;
v.x = startBlockLastPos.x - endBlockLastPos.x;
v.y = startBlockLastPos.y - endBlockLastPos.y;
xm = v.x*v.x;
ym = v.y*v.y;
magnitude = sqrt((xm+ym));
if (magnitude != 0)
{
shotDirection.x = (v.x/magnitude);
shotDirection.y = (v.y/magnitude);
NSLog(@"mag: %f shotdirection(%f,%f)\n", magnitude, shotDirection.x, shotDirection.y);
}
}
So long and stay thirst my friends