draw_line(Protagonist.x,Protagonist.y,Protagonist.x+800* arccos(point_direction(Protagonist.x,Protagonist.y,Prot_aimer.x,Prot_ aimer.y)),Protagonist.y+800*arcsin(point_direction(Protagonist.x,Protagonist.y,Prot_aimer.x,Prot_ aimer.y)));This is trying to draw the line from Protagonist's origin in the direction of Prot_aimer's orgin, extending for 800 pixels. Prot_aimer is a moving object so its origin varies, but its direction from Protagonist is always between 0 degrees and 180 degrees.
Whenever I use this code, the line is 800 pixels long as planned, but it is always going in the wrong direction, usually favoring towards the bottom left. I have tried switching the Protagonist coordinates and Prot_aimer coordinates with each other in point_direction. I have tried adding 90, adding 180, or subtracting 180 from the direction. I have tried switching the directions to negatives. I have tried using if statements declaring if the direction is supposed to be generally towards the left or generally towards the right. I have tried making the length shorter. None of these fixed the direction problem, and they usually ended up in the direction being towards the bottom left.
I have searched if there is code to do this on GMLscripts.com, and could not find any. Please help if you can.
Edited by Nijg, 14 August 2009 - 06:06 PM.