Thread: Space Jump
View Single Post
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 11-30-2012, 10:10 AM

The reason why it didn't stop when it got to the island is because you were telling the boat to stop when it's coordinates where less than 1 meter away from the coordinates of the island's palm tree, and that never happened.

If you look at the program that I attached, I changed it so that the "my first method" function first turns the boat to face the island (which was one of the questions), and then recursively calls your method to make the sailboat move forward (I made the animation more fluid by making it move "abruptly"). I also changed the distance that it checks to 15 meters, not 1. This will make the boat stop 15 meters away from the coordinates of the island, which makes it stop exactly where you need it too, just touching the beach. The only thing that I didn't fix is the last part. I kept your code in there to just take a good look at the island, but what you're really supposed to do is set the camera to be above the island, looking down. This is easy camera code and you can do it in 2 steps.
Attached Files
File Type: a2w Recursive Sailing (1).a2w (219.8 KB, 12 views)


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote