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
Then you need an earth which is flying around you sun ... a good startpoint would bewhenclicked
go to x:0y: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!whenclicked
go to x:-170y:0
It also has to go up and when then down and thats what the "walker" is for.whenclicked
go to x:-170y:0foreversetwalkerto0repeat untilx position<0change x by1,69
Ok, 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 bewhenclicked
go to x:-170y:0foreversetwalkerto0repeat untilx position<0change x by1,69change y by3-walkerof course you need a mathblock: [(3) - (walker)]changewalkerby0.03
After 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 XDchange y by0because the walker will be 3 ... and 3 - 3 is of course 0 ;D
now it changes x by -1,69 and moves to the left again.whenclicked
go to x:-170y:0foreversetwalkerto0repeat untilx position<0change x by1,69change y by3-walkerchangewalkerby0.03setwalkerto0repeat untilx position>0know it does this until x is larger then 0 because then it made the whole circlechange x by-1,69__________or more or less eclipse around the sun and starts again with the first loop.
Well, you could say "(+) Walker - 3" instead of "-3 + walker"whenclicked
go to x:-170y:0foreversetwalkerto0repeat untilx position<0change x by1,69change y by3-walkerchangewalkerby0.03setwalkerto0repeat untilx position>0change x by-1,69change y by-3 + Walker+ walker, so that it will be -3 + 3 = 0 at one point, like in the other loopchangewalkerby0,03
Ok, thats how the earth would move around the sun! And the moon ... I will try something and post laterwhenclicked
go to x:-170y:0foreversetwalkerto0repeat untilx position<0change x by1,69change y by3-walkerchangewalkerby0.03setwalkerto0repeat untilx position>0change x by-1,69change y byWalker - 3+ walker, so that it will be -3 + 3 = 0 at one point, like in the other loopchangewalkerby0,03
Offline
Much easier way:
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!whenclicked
in sun spritego to x:0y:0whenclicked
in earth/moon spritego to x:0y:100setn ▼to0foreverclearchangen ▼by1replace 1 with desired orbit speed for moon.point towardssun ▼turn
87degreesmove5stepsswitch to costumeearth ▼stampchange x by*sin ▼ofn50replace 50 with the desired orbit radius of the moonchange y by*cos ▼ofn50switch to costumemoon ▼stampchange x by*sin ▼ofn-50remember, -50 not 50change y by*cos ▼ofn-50
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:
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!whenclicked
in sun spritego to x:0y:0whenclicked
in earth/moon spritego to x:0y:100setn ▼to0foreverclearchangen ▼by1replace 1 with desired orbit speed for moon.point towardssun ▼turn
87degreesmove5stepsswitch to costumeearth ▼stampchange x by*sin ▼ofn50replace 50 with the desired orbit radius of the moonchange y by*cos ▼ofn50switch to costumemoon ▼stampchange x by*sin ▼ofn-50remember, -50 not 50change y by*cos ▼ofn-50
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:
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!whenclicked
in sun spritego to x:0y:0whenclicked
in earth/moon spritego to x:0y:100setn ▼to0foreverclearchangen ▼by1replace 1 with desired orbit speed for moon.point towardssun ▼turn
87degreesmove5stepsswitch to costumeearth ▼stampchange x by*sin ▼ofn50replace 50 with the desired orbit radius of the moonchange y by*cos ▼ofn50switch to costumemoon ▼stampchange x by*sin ▼ofn-50remember, -50 not 50change y by*cos ▼ofn-50
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.
whenclicked
go tocomputer ▼broadcastpost new topic on forum ▼wait untilreply?=truethinkRead replyfor2secswait untilfinished reading?=truesayHUH?!
Last edited by jedidiahzhu (2012-03-31 00:40:26)
Offline