Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Orbits

Status
Not open for further replies.

Eskimoquinn

Programmer
Mar 12, 2009
2
GB
Hi, I'm fairly new to programming and have started with VBScript. I'm planning to construct a two dimensional solar system program, but I am unsure of one vital thing; orbits. I have an idea of how the moon can orbit the Earth but can't make it work properly, and am unsure on how to make an object that is orbiting an object.. orbit another object (i.e. the sun).

Any help would be greatly appreciated.

Thank you.

P.S.
It is also web-based (I'm not sure if you really need that detail, but I thought I'd include it anyway).
 
What have you tried so far?

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
So far I just have the HTML code and my VBScript is tiny at the moment;

Sub Window_OnLoad()
imgEarth.style.pixelLeft = document.body.clientwidth / 2
imgMoon.style.pixelLeft = imgEarth.style.pixelLeft
txtAngle.value = 0
End Sub

'Alters moon position relative to Earth
Sub btnCalc_OnClick()
imgMoon.Style.PixelLeft = imgEarth.style.PixelLeft + (Sin(txtAngle.value) * 150)
imgMoon.Style.PixelTop = imgEarth.style.PixelTop + (Cos(txtAngle.value) * 150)
Window.SetInterval "MoveMoonRight", 50
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top