Senap
02-01-2008, 09:07 PM
Hi
I'm using Andorra2D (http://www.pascalgamedevelopment.com/viewtopic.php?t=4123&highlight=andorra) to make a utility, similar to a map editor, for a game. The utility displays several rectangular zones and I want to connect all of these with lines.
Instead of simply drawing static lines on the canvas, I am trying to use sprites to connect the rectangular sprites. This way I can drag the lines and manipulate them in various ways along with storing variables in the sprite objects.
I am having trouble figuring out how to determine the rotation angle of the line sprite. Can you give me pointers as to how I can solve this math problem? I have the x/y positions of two rectangles and I can of course figure out the length between the two, but I'm stuck and can't get any further.
Hopefully someone can help me, I feel stupid for not being able to solve this on my own :oops:
I'm using Andorra2D (http://www.pascalgamedevelopment.com/viewtopic.php?t=4123&highlight=andorra) to make a utility, similar to a map editor, for a game. The utility displays several rectangular zones and I want to connect all of these with lines.
Instead of simply drawing static lines on the canvas, I am trying to use sprites to connect the rectangular sprites. This way I can drag the lines and manipulate them in various ways along with storing variables in the sprite objects.
I am having trouble figuring out how to determine the rotation angle of the line sprite. Can you give me pointers as to how I can solve this math problem? I have the x/y positions of two rectangles and I can of course figure out the length between the two, but I'm stuck and can't get any further.
Hopefully someone can help me, I feel stupid for not being able to solve this on my own :oops: