Hi
This seems like it shouldn't be that hard but I feel like I've hit a wall. Any help would be gratefully received.
I want to position sprite01 relative to sprite02
Sprite01 has two local variables: angle, and distance.
I want to position sprite02 relative to sprite 01 according to the angle and distance stored in the local variables of sprite 01
Should I be using trigonometry here or am I missing something really obvious?!
Thanks
you could use the Angle(x1, y1, x2, y2) and distance(x1, y1, x2, y2) expressions I think for that, like this:
Sprite01 : Set instance variable distance to: distance(Sprite01.X, Sprite01.Y, Sprite02.X, Sprite02.Y)
Sprite01 : Set instance variable angles to: angle(Sprite01.X, Sprite01.Y, Sprite02.X, Sprite02.Y)
EDIT: I think I understood that you wanted to store the angle and distance, but if you'd rather set the position using this, then you'd have to:
Sprite02 : Set X to Sprite01.distance*cos(Sprite01.angles)
Sprite02 : Set X to Sprite01.distance*sin(Sprite01.angles)
(I used the name "Angles" for the variable since I am not sure you can use the word "angle")