Thread: Space Jump
View Single Post
Exercise 2 (Recursive Sailing) in Ch. 8 of Starting Out with Alice
Old
cedricdosss
Junior Member
 
Status: Offline
Posts: 10
Join Date: Nov 2012
Default Exercise 2 (Recursive Sailing) in Ch. 8 of Starting Out with Alice - 11-30-2012, 05:58 AM

I have this simple project I'm working, It about recursion. I do not get why the program will not stop when the boat is within 1 meter. And I am also trying to have the camera take a good look at the island. Help please.


Create a sea world with a boat and an island. Position the island some distance away from the boat. Write a method named sailTo, which has an Object parameter. The method should cause the boat to move one meter toward the object and then recursively call itself until the boat has reached the object. Test the method by calling it and passing the island as the argument.

Here are additional requirements:


1. The sailboat must appear to be in the water.
2. It should turn and face the island.
3. The sailboat must reach the island independent of where it is initially placed.
4. The sailboat should move towards the island object until it touches the island (not get beached).
5. The camera should be above the island looking down to verify that the boat touches the island.
Attached Files
File Type: a2w Recursive Sailing.a2w (227.3 KB, 6 views)
   
Reply With Quote