×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*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.

Students Click Here

Help with rotation!

Help with rotation!

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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close