Tutorial: Part Two of Methods

By Deborah Nelson
Duke University, July 16, 2008

Under the direction of Professor Susan Rodger

As you follow the instructions below, click on an image to enlarge it.

Then use the'go back one page' arrow in your web browser to come back to this tutorial.

We will now complete the world that you started in part one of the tutorial entitled "Methods." If you have not yet done Part One, you must go through that tutorial first.

Loading the World

For this tutorial, you can use your completed version from part one of the Methods tutorial. That world was entitled methodStart.a2w.

Or you can download the version of the world with the solution from part one here. Remember to save it in a directory that you can find again, and then start Alice and open the world. NOTE: You cannot double-click the file to open it; Windows will not know what to use, and even if you select Alice from a list of programs, the loading will fail.

Part 1: Parameters

Dragging kangaroo.challenge:

Selecting the turtle as the parameter argument:

Testing kangaroo.challenge on another object

Play your world. Now after the race, the kangaroo challenges the turtle and then the tortoise.

Depending on where you placed the tortoise in your world, you may notice that having the kangaroo hop twice toward him does not look very good. Once you know how to use the built in function 'distance to' you can improve the appearance of this method. For now, don't worry about it.

Let's finish making the rest of our world. In world.myfirstmethod, delete the second call to kangaroo.challenge for the tortoise. If you want, you can delete the entire tortoise from your world.

Part 2: Properties

Press play to watch your entire simulation.