×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Help with rotation!

## Help with rotation!

Replies continue below

### RE: Help with rotation!

If you mean you want something to rotate according to the mouse position, the formula is:

angle = atan of (y position / x position)

Kenneth Kawamoto
www.materiaprima.co.uk

### RE: Help with rotation!

(OP)
hey kenneth!.. thanks so much for your reply, that is exactly what i want to do.. i know this is so basic but i can work out the lingo despite your informative post.  I assume it should be a behavior script applied to the "gun"..
err...
on beginsprite me
set angle = atan of (y position / x position)
end
??? if you could help me correct this it would be much appreciated!!..
Regards,
STAFF

### RE: Help with rotation!

angle = atan of (y position / x position)

This was a concept, not a Lingo script.

The real script will be little bit more complex:

-- Frame script (Director 10)
on exitFrame me
movieW = the stageRight - the stageLeft
movieH = the stageBottom - the stageTop
h = _mouse.mouseH - movieW/2
v = movieH - _mouse.mouseV
if h <> 0 then
sprite(1).rotation = -atan(v/h)*180/pi
end if
_movie.go(_movie.frame)
end
--

Sprite(1) is the object to rotate i.e. "gun".

Kenneth Kawamoto
www.materiaprima.co.uk

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!