Computer Science Canada Making moons orbit my planet |
Author: | sammi [ Thu Oct 20, 2011 7:00 pm ] | ||
Post subject: | Making moons orbit my planet | ||
What is it you are trying to achieve? <im trying to make my moon orbit my planet> What is the problem you are having? <the moon is right in the middle of my planet (the orange dot) but i cant seem to make it orbit around the outside> Describe what you have tried to solve this problem <Answer Here> Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using <4.11 i think> |
Author: | Raknarg [ Thu Oct 20, 2011 7:24 pm ] |
Post subject: | RE:Making moons orbit my planet |
You're using DistMerc for your moon and mercury. They're in the same spot. |
Author: | sammi [ Thu Oct 20, 2011 7:28 pm ] |
Post subject: | RE:Making moons orbit my planet |
kay i figured that out now i just need it to orbit the gray planet |
Author: | Aange10 [ Thu Oct 20, 2011 7:57 pm ] |
Post subject: | Re: RE:Making moons orbit my planet |
sammi @ 20/10/2011, 6:28 pm wrote: kay i figured that out now i just need it to orbit the gray planet
How would you go about making it orbit the grey planet? When do you want it to orbit the planet and not the orange dot? If it's distance is within 10 pixles? How would you go about telling the computer what you want it to do? |
Author: | sammi [ Thu Oct 20, 2011 7:59 pm ] |
Post subject: | Re: RE:Making moons orbit my planet |
Aange10 @ Thu Oct 20, 2011 7:57 pm wrote: sammi @ 20/10/2011, 6:28 pm wrote: kay i figured that out now i just need it to orbit the gray planet
How would you go about making it orbit the grey planet? When do you want it to orbit the planet and not the orange dot? If it's distance is within 10 pixles? How would you go about telling the computer what you want it to do? sorry not understanding what you mean....... |
Author: | Raknarg [ Thu Oct 20, 2011 8:06 pm ] |
Post subject: | RE:Making moons orbit my planet |
Well, basically you're setting the distance relative to the planet like the planet is to the sun. The distance away is the distance of the planet away from the sun, plus its own distance away from that planet. |
Author: | Beastinonyou [ Thu Oct 20, 2011 9:49 pm ] | ||||||||||
Post subject: | Re: Making moons orbit my planet | ||||||||||
sammi wrote: sorry not understanding what you mean....... He's simply phrasing it in a way that tries to make you figure it out by yourself. It's always better to attempt things by yourself for awhile before posting for help. After looking at your code, it seems that you are orbiting the Moon around the Sun in the same position as Mercury, which is why the Moon is on Mercury. If you take a look at your code, you have this:
That is basically drawing your Moon at the same spot Mercury is orbiting the sun at. (You have found this error) If you look below, technically, it should be this, to be correct in terms of drawing the moon
However, If you run that line, you get the Moon orbiting around the very center of the Sun, Now being Inside the Sun. If you modify that line a bit more, you get this:
When you run that line into your program, Although it Appears to be orbiting your planet, it Really just orbiting the sun, directly behind Mercury. Finally, If you make some further modifications to your program, you can end up with this:
Notice my Changes? I'll Point them out:
If you have any questions, let me know. It took me awhile to properly get it, but hey, No school tomorrow, so extra programming time for me =P |
Author: | sammi [ Sat Oct 22, 2011 12:22 pm ] |
Post subject: | RE:Making moons orbit my planet |
i have another problem........but before i post my code what do i have to put in front of it to make it look like the code above? i cant remember.... |
Author: | Zren [ Sat Oct 22, 2011 1:08 pm ] | ||
Post subject: | RE:Making moons orbit my planet | ||
|
Author: | sammi [ Sun Oct 23, 2011 1:46 pm ] | ||
Post subject: | RE:Making moons orbit my planet | ||
whats the command for importing a picture? I want a picture of a spaceship to zoom through underneath my solar system.
|
Author: | Beastinonyou [ Sun Oct 23, 2011 2:25 pm ] | ||||
Post subject: | Re: Making moons orbit my planet | ||||
sammi wrote: whats the command for importing a picture? I want a picture of a spaceship to zoom through underneath my solar system. I see you've took my example of the moons orbiting, and done it to the other planets. What you're looking for would be this:
To move it, you could just make a variable, shipX, and increment its value each time you go through the loop, then draw the picture at that x-value. Example:
Also, I would advise looking into arrays. A lot more organized, with much less var lines. |