I need to make a project showing the sun, moon, and earth moving in the solar system. HELP!!
I need the earth to orbit the sun, the earth to spin, the moon to orbit the earth, and for the earth to tilt toward the moon.
Last edited by jedidiahzhu (2012-03-31 00:35:32)
Offline
For homework? Ya teacher is mean ^__~ But I'll try to help you ...
First you need 3 objects of course ...
The moon (I'll do that later) and the sun, which has the code
when gf clicked go to x: (0) y: (0)Then you need an earth which is flying around you sun ... a good startpoint would be
when gf clicked go to x: (-170) y: (0)Next the movements of the earth. I created a variable I named "walker". First, I set the walker to zero. Also, I told the earth to do the first half of the movent until its y-position is smaller than zero. The earth shall change x by 1,69 every round so that it moves to the right!
when gf clicked go to x: (-170) y: (0) forever set [walker] to (0) repeat until <(x position) < [0] > change x by [1,69] endIt also has to go up and when then down and thats what the "walker" is for.
when gf clicked go to x: (-170) y: (0) forever set [walker] to (0) repeat until <(x position) < [0] > change x by [1,69] change y by [3-walker] // of course you need a mathblock: [(3) - (walker)] change [walker] by (0.03) endOk, the first round, it moves 3 up (3-0, because the walker is 0) then 3-0.03, then 3-0.03-0.03 and so on. When it's above the earth, it will be
change y by [0] //because the walker will be 3 ... and 3 - 3 is of course 0 ;DAfter this, it will go on like 3-3,03 (=-0,03) ... 3-3,06 (=-0,06) and so on and that gives negative numbers so the earth starts moving down ... I hope you understood how this works XD
when gf clicked go to x: (-170) y: (0) forever set [walker] to (0) repeat until <(x position) < [0] > change x by [1,69] change y by [3-walker] change [walker] by (0.03) end set [walker] to (0) repeat until <(x position) > [0] > //know it does this until x is larger then 0 because then it made the whole circle change x by [-1,69] //__________or more or less eclipse around the sun and starts again with the first loop. endnow it changes x by -1,69 and moves to the left again.
when gf clicked go to x: (-170) y: (0) forever set [walker] to (0) repeat until <(x position) < [0] > change x by [1,69] change y by [3-walker] change [walker] by (0.03) end set [walker] to (0) repeat until <(x position) > [0] > change x by [-1,69] change y by [-3 + Walker] //+ walker, so that it will be -3 + 3 = 0 at one point, like in the other loop change [walker] by [0,03] endWell, you could say "(+) Walker - 3" instead of "-3 + walker"
when gf clicked go to x: (-170) y: (0) forever set [walker] to (0) repeat until <(x position) < [0] > change x by [1,69] change y by [3-walker] change [walker] by (0.03) end set [walker] to (0) repeat until <(x position) > [0] > change x by [-1,69] change y by [Walker - 3] //+ walker, so that it will be -3 + 3 = 0 at one point, like in the other loop change [walker] by [0,03] endOk, thats how the earth would move around the sun! And the moon ... I will try something and post later
Offline
Much easier way:
when gf clicked // in sun sprite go to x:(0) y:(0) when gf clicked // in earth/moon sprite go to x:(0) y:(100) set [n v] to (0) forever clear change [n v] by (1)//replace 1 with desired orbit speed for moon. point towards [sun v] turn ccw (87) degrees move (5) steps switch to costume [earth v] stamp change x by (([sin v] of (n)) * (50))//replace 50 with the desired orbit radius of the moon change y by (([cos v] of (n)) * (50)) switch to costume [moon v] stamp change x by (([sin v] of (n)) * (-50))//remember, -50 not 50 change y by (([cos v] of (n)) * (-50))Of course, these orbits are circular. In reality, the orbits are elliptical, but I'm sure you math teacher isn't that mean. Anyway, enjoy this script, it's fun to watch!
Last edited by Hardmath123 (2012-03-29 09:40:31)
Offline
jedidiahzhu wrote:
I need to make a project showing the sun, moon, and earth moving in the solar system. HELP!!
I need the earth to orbit the sun, the the earth to spin, the moon to orbit the earth, and for the earth to tilt toward the moon.
Hi guys, thanks for all your replies, but I want to do a 3D one (No, my teacher didn't tell me to do it). This way I can show the earth's tilt in a more easy way.
Right now, I managed to do the sun and the earth; they are working perfectly.
This is the address of what I did so far: http://scratch.mit.edu/projects/jedidiahzhu/2433783
The moon, however, is not cooperating. I have no idea how to make it orbit the earth.
Thanks all!
Offline
Ah. Interesting idea. You'll have to use a bit of trigonometry: keep incrementing a variable X and set the Earth's X position to sin(x)*100. Then set the moon's X position to X position of Earth + sin (x)*50.
Also, you'll need to constantly use Set X to (X mod 360).
Finally, to counter the layers problem, make sure:
Earth is above Sun when X>180, below at all other times.
Moon is above Earth when X>180, below at all other times.
Last edited by Hardmath123 (2012-03-30 09:36:00)
Offline
Hardmath123 wrote:
Much easier way:
when gf clicked // in sun sprite go to x:(0) y:(0) when gf clicked // in earth/moon sprite go to x:(0) y:(100) set [n v] to (0) forever clear change [n v] by (1)//replace 1 with desired orbit speed for moon. point towards [sun v] turn ccw (87) degrees move (5) steps switch to costume [earth v] stamp change x by (([sin v] of (n)) * (50))//replace 50 with the desired orbit radius of the moon change y by (([cos v] of (n)) * (50)) switch to costume [moon v] stamp change x by (([sin v] of (n)) * (-50))//remember, -50 not 50 change y by (([cos v] of (n)) * (-50))Of course, these orbits are circular. In reality, the orbits are elliptical, but I'm sure you math teacher isn't that mean. Anyway, enjoy this script, it's fun to watch!
If your math teacher asks, by the way, say, "It is based on the principal that a tangent to a circular orbit will be perpendicular to the corresponding radius; and plotting all solutions of cos(arcsin(x)) returns a circle."
Memorize it. That ought to stun him!
Not quite....needs to be set x/y to not change x/y by.
Offline
AtomicBawm3 wrote:
Hardmath123 wrote:
Much easier way:
when gf clicked // in sun sprite go to x:(0) y:(0) when gf clicked // in earth/moon sprite go to x:(0) y:(100) set [n v] to (0) forever clear change [n v] by (1)//replace 1 with desired orbit speed for moon. point towards [sun v] turn ccw (87) degrees move (5) steps switch to costume [earth v] stamp change x by (([sin v] of (n)) * (50))//replace 50 with the desired orbit radius of the moon change y by (([cos v] of (n)) * (50)) switch to costume [moon v] stamp change x by (([sin v] of (n)) * (-50))//remember, -50 not 50 change y by (([cos v] of (n)) * (-50))Of course, these orbits are circular. In reality, the orbits are elliptical, but I'm sure you math teacher isn't that mean. Anyway, enjoy this script, it's fun to watch!
If your math teacher asks, by the way, say, "It is based on the principal that a tangent to a circular orbit will be perpendicular to the corresponding radius; and plotting all solutions of cos(arcsin(x)) returns a circle."
Memorize it. That ought to stun him!Not quite....needs to be set x/y to not change x/y by.
Oops. Error in copying the blocks, my bad...
EDIT: No, it should be change. Try it out yourself! So, not my mistake!
Last edited by Hardmath123 (2012-03-30 12:52:35)
Offline
Hardmath123 wrote:
Ah. Interesting idea. You'll have to use a bit of trigonometry: keep incrementing a variable X and set the Earth's X position to sin(x)*100. Then set the moon's X position to X position of Earth + sin (x)*50.
Also, you'll need to constantly use Set X to (X mod 360).
Finally, to counter the layers problem, make sure:
Earth is above Sun when X>180, below at all other times.
Moon is above Earth when X>180, below at all other times.
Huh. No idea what you're talking about, but thanks! XD I'll try it.
when gf clicked go to [computer v] broadcast [post new topic on forum v] wait until <(reply?)=[true]> think [Read reply] for (2) secs wait until <(finished reading?)=[true]> say [HUH?!]
Last edited by jedidiahzhu (2012-03-31 00:40:26)
Offline