Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Spinning Line!!

This topic is 6251 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can some one plz explain to me how to make a simple line spin in visual basic? I''ve been looking for a way for days now, and am coming up empty handed! If someone write the code that would be a little better.. thx

Share this post

Link to post
Share on other sites
Well, I don''t know how to do it in Visual Basic, but, regardless, it''ll take a little Trig.

Basically, you''ll want to have 2 variables: Degree of Line (between 0 and 360) and Radius of circle(the length of the line).

Then, what you''ll do is this:
You have an X,Y which is center of your circle, and Radius.

You basically loop through, incrementing the degree of the angle, then figure out where the end of the line is and draw it
Xlength = Cos (angle in radians)/Radius
Ylength = Sin (angle in radians)/Radius

DrawLine(X, Y, X + Xlength, Y + Ylength);

to get radians, you take the degrees and multiply by Pi/180

Hope that helps some.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!