Codecademy Help Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Need help with my program. Im new

Michael Jan 09, 2014 08:54PM EST

So i was doing the Sun, Earth and Code tutorial. I finished it easily. I decided to take it to the next level, and thats where I need your help. My goal was to make a moon orbit the earth, which is orbiting the sun. I'm very close. I have lined up the moon on the earths orbit, but I'm not sure how to make the moon orbit a moving earth. Here is the link to what I have so far: http://www.codecademy.com/yasgur99/codebits/WScKP3/edit
If someone could please tell me how so i could go on and maybe try to make a moon orbit that moon, I would greatly appreciate it.
Thanks!
~Mike
PS: I'm new to coding and I was wondering what the best base code to learn is. I'm not really sure what I want to do, but I know I will put it to use. I was thinking along the lines of HTML or JavaScript. Any thoughts on that?

Up 5 rated Down
Josh Jan 19, 2014 05:25PM EST
Hey! I was actually wondering this exact same thing, and looking at your code helped me figure it out!

My idea was, since in the original course the earth is kinda "stuck" to the div that is the orbit, stick your
orbiting moon to the div in the same place (i hope that makes sense)

So I took the moon id and div and nested it in your earth id and div, so the moon div would be stuck to the orbit div, just like the earth id was stuck to the orbit div. then I adjusted the moon orbit speed, and the location a tad. ended up with this:
http://www.codecademy.com/banglinator/codebits/BgoNRg/edit?forked=true

Hope that made sense, it does in my head! lol
Up 5 rated Down
Josh Jan 19, 2014 05:39PM EST
This I think is the URL I should have linked for you, sorry!

http://www.codecademy.com/banglinator/codebits/BgoNRg
Up 4 rated Down
Ben Apr 14, 2014 01:19PM EDT
all you guys gotta do is create and id for 2 orbits one for the moon to orbit around earth then an orbit for your moons orbit i set it up like this.....

(my id's are so long because I am adding the whole solar system, that is if i didnt run out of room which i think I did, is that even possible???)

<div id="earth-moon-orbit-orbit"><div id="earth-moon-orbit"><img id="earth-moon" src="image source here"/></div></div>

for a reference check out my solar system i have quite a bit so far.... but my mercury and venus do this not centered orbit thing if you full screen it.....
http://www.codecademy.com/Bwright4D/codebits/5LP40S/edit
Up 4 rated Down
Ben Apr 14, 2014 01:35PM EDT
holy shit i just read josh's answer all the way threw I'm combining our techniques because it will not allow me to add anymore html elements so i need to utilize my space more efficiently so I'm hoping nesting the planets moons orbits within the planets orbit will create more usable space cause I'm lacking 2 moons for Jupiter (only using the big ones not putting all 60 something moons in there ha) 3 more planets their moons and both asteroid belts and screw Pluto can be a planet again!!!
Up 1 rated Down
Loïc Apr 14, 2014 11:18PM EDT
http://www.codecademy.com/chipJumper44591/codebits/sus66S

Codecademy is awesome =)

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)
contact@codecademy.com
http://assets04.desk.com/
false
codecademy
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete