1. ## Little Help please with angles

I am making an rpg for my website using ajax and javascript.

I have the character moving around my page.

If you go to http://liveanime.org/rpg/ you will understand better.

If you click to the left of the character the gif that walks left will show, and if you click right of the character the gif that walks right will show. Now my problem is walking up and down.

The basis of this problem is maths. I have the current x and y position of the character and the x and y position of where he will end up. I use pythag to work out that distance, now i would like to work out the angle of the line from where the character is to where hell end up.

Triganometry... lol, while i need no code, just some sudo code/equations...

i would like the "upwards" gif to show if (using directly right as 0 degrees and increasing clockwise) the angle is between 225-315 degrees and the "downward" gif if the angle is between 45-135.

an image to help expalin.

any help really apreciated.

(if you want to test out whats there so far the only thing you can do, is move about and kill the enemy in the bottom right lol)

thanks alot

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•