Skip to main content
Inspiring
July 20, 2008
Question

Moving an object diagonally

  • July 20, 2008
  • 1 reply
  • 6960 views
I'm trying to move an object diagnally (using x and y increments).
I know it would be easy to do this with an object traveling in a straight path on a 45 degree angle, but I am using another angle. The angle i need the object to move is 50 degrees.

Here is a graphic of what i'm looking to achieve
This topic has been closed for replies.

1 reply

Inspiring
July 20, 2008
This code will move an object continuously between the bounds of the stage at the angle you specified (50 degrees from top of stage).

TS
_Vee_Author
Inspiring
July 20, 2008
Thanks. Thats almost right. They x and the y are not moving proportionately. You can see the diag. line move up and down too much in the y direction. Im looking for the line to travel only at that 50º angle/as though its stuck on a traintrack, if that makes sense.

FYI: my movieclip (diagLine_mc) is already at the 50º angle in my library.
Inspiring
July 20, 2008
Heres the fla
You don't have your diagonal line at 50º as Flash would transform it. How did you calculate the angle of the movie clip? If you draw a line that's perfectly horizontal, then in the Transform window of Flash set its rotation to 50º, you'll see it's a different angle than yours. Here's the FLA with the adjusted angle.

TS