Alice+Tut2+Getting+Loopy


 * ~ home ..... Getting Started ..... ||~ Tutorials and Commands ..... ||~ resources ||

Getting Loopy with Loops!

This tutorial will show you how create a loop (repetitive control structure) in Alice. After completing this you will have learned how to make an object move around the screen in a repetitive loop.

1. To start, open up Alice from the applications folder. You should see something similar to this screen.



2. Close the welcome screen.

3. Bring in an object of your choice by selecting the green **ADD OBJECTS** button. I am going to use the angel that can be found in the 'ancients' section.



4. Once you have added your instance into the world, click on your object to see what methods are available to you.

5. Let’s first make the object (my angel for example) move to the left, then move forward, then move to the right, then move backwards. This will make it move in a square pattern one time. To do this select the object's move method and drag and drop to the my first method area. First select left 1 m, then repeat this to add the move method 3 more times as shown below.

6. Now it is time to get LOOPY! select the Loop button at the bottom of the screen and drag it to the top of the list of move methods for your object.

7. Now to make the loop work, we must drag and drop each method into the loop itself. - I chose 5 loops



Notice now, each of your object's move methods are inside the looping construct (in light blue). If you run the world, you will see your object loop through the square pattern 5 times. yay! It looks like a creepy chess piece!

Well done!