thanks!
I had to add "degtorad" to convert my degrees into radians.
For some reason I couldn't have degtorad resolved and stored in a variable earlier in the script, it had to be a part of the sin and cos lines. So now it gets computed twice instead of once. but it works.
Here is the final code for anyone else that wants it.
The animation # of one actor determines the direction the other actor is off at.
- Code: Select all
a=(actorA.animpos*9);
//there are a total of 40 frames of animation (9*40=360 degrees)//
//so "a" equals my slope/direction that I want it at.//
offsetx = sin(degtorad(a))*31;
offsety = cos(degtorad(a))*31;
//degtorad converts degrees"(a)" into radians (sin/cos need to work in radians)//
//31 is the distance the new actor will be from this actor//
actorB.x = actorA.x - offsetx;
actorB.y = actorA.y + offsety;
//this changes the x/y coordinants of the new actor//