Assignment+2

= Alice Lesson 2: Dance Contest = Combining Methods, If-Else, Do in order, Do Together, Loop, and Key Commands.

In the Introduction to Alice we explored combining Methods to create sequences of movement. Now we will combine these methods with conditional statements and looping to create a simple program.

Combining Methods

Methods can be strung together to create longer sequences of movement. For example, several methods can be strung together to create a longer dance sequence:



If-Else

Like in Scratch, we use If-Else to check a condition and then do a response.



In the above example, it states that if the variable world.danceOn is equal to 1, then do the method "Dancer.dancing." If world.danceOn does not equal 1, then do nothing.

Do Together

When we want a sequence of methods to happen at the same time, we put the methods inside a "Do Together."



In the above example, the method Dancer.jumpUp will happen at the same time as turning the Dancer to the right.

Do in Order

Do in order is used within Loops and Do Together to ensure that a methods execute in a certain sequence.

Loop

The Loop repeats a sequence of methods. It can be a set number of times or go on "forever."



Here, the method stageSpotLight.randomMove will execute over and over until the program ends.

BUT WAIT!!!

In Scratch we can assign key commands to allow the use to control aspects of the program. Can we do that in Alice?

Yes! In the Events Pane click on the button "Create New Event." Then select "When Key is Typed." Select a keyboard letter and a method When the program is played, touching the key will call the method into action.



Putting it all together.

By combining:
 * Methods (What Ojects Do)
 * If-Else (When and under what conditions the Methods happen)
 * Do Together (Happening at the same time)
 * Do in order
 * Loop (How often methods happen)
 * Key Commands

we create games, animations, and simulations. Here is an example:



Within the "world.my first method" is where we typically assemble the core of the program. Dancers dance, Spotlights move, and music plays!

Alice Assignement #2:

Create a Dance Program that allows the user to control at least 6 specific movements with key commands. In addition, create an object that when clicked sets the dancer in motion. When the object is clicked again, the dancer stops dancing. Use music and a lighting to make things interesting. You may use any animal or human as the dancer. (The Object Class must have arms, legs, and head parts for dancing.) You may reuse the human character from Assignment #1.

Requirements:

1. Select an Object and create at least 5 different methods for dance moves. 2. Assign key controls to each method so the user can type key inputs to make the object dance. 3. Add background music to the program. 4. Design a visually interesting set for the dancer to perform on.

Extras: 1. Create methods allows the user to click on an object (button, speaker, . . .) and start the dancer dancing automatically. 2. Add moving lighting effects, fog, and colors. Hint: Import a class Spotlight and aim light at dancer. Create methods to randomly move the Spotlight.

Rubric:


 * || Does Not Meet the Standard || Meets the Standard || Exceeds the Standard ||
 * Use of Methods || Less than 5 Methods for Dance moves || Between 5 and 7 Methods for Dance moves. || More than 7 methods of Dance moves. ||
 * Use of If-Else, Loops, Do Together, and Key Commands || Does not use If-Else, Loops, Do Together, or Key Commands. || Uses at least 1 of each type. || Multiple and correct usage of If-Else, Loops, Do Together, and Key Commands. ||
 * Functionality of Program || Does not work. No moves or music. || Program allows user to have key inputs to make the object dance. Music plays. Music is properly cited in notes or comments. || Program functions with user input and a switch to start and stop automatic dancing. ||
 * Visual Layout || No use of other objects, colors, or lighting. || Some sense of setting and lighting used. || Tasteful use of lighting, spotlights, fog, and colors to set the scene. ||