Quote:
Originally Posted by acemasters
I'm working on a world where two spaceships must orbit the Earth. One must be close to the
Earth and orbiting fast. The other must be far away and orbit slowly. The first one I have
done. But when I work on spaceship number two adding it to the call all it does is rotate
in place without moving. And if I add While to the call it ends up stopping the first
spaceship from orbiting. Can someone help me find what I am missing?
|
There are a couple of problems with your approach. First let me state that there are usually several ways to do something in a program and it is not what is right or wrong its what best reflects the problem or meets the constraints of the system involved.
In Alice you are working with graphical objects and there are some options that should be used whenever possible. If you want one thing to move around another, smoothly and without a "box step" look use the "as seen by" option to the turn command. As in:
spaceship turn right 1 revolution as seen by globe
or better yet, for your situation:
spaceship turn at speed 0.1 revolutions per second as seen by globe
Also (IMHO) using infinite loops in your methods is not a good idea. It causes problems that are hard for a beginner to ferret out and seems to bog Alice down when compared to using events. If you truely want to have the ships orbit all the time, add a "When the world starts" event and the right click it and change it to while the world is running and through your circle method in the "during" section.
Another choice would be to use the "When something is true" event. You can then create a boolean variable that can turn the orbiting on and off whenever you want.
Mark