Welcome to Computer Programming

Alice Assignments - SUBMIT

Section 1

1-1

Create a person (try to make them look like you) Add a table of some kind. Have him looking at the table.


1-2

Add two snowmen (People gallery folder) to a snowy scene. Then, create a snowman stack to position one snowman on top of the other (vertically), as shown below.


1-3

Create a scene with an island and a shark around it. Try to submerge the shark.

Section 2

2-1

A snowman is trying to meet a snowwoman who is talking with a friend (another snow­woman[not shown above, add her].) The snowman tries to get her attention. He turns to face the snowwoman and says "Ahem." She turns to look at the snowman. She blush­es (her whole body turns red). But, alas, she is not interested in meeting him. She gives him a "cold shoulder" and turns back to talk with her friend. He hangs his head in disappointment and turns away.


2-2

Open the world with a person and table and than add some food on the table.Position the person right next to the table then use a move method to move him 2 meters away from the stool. (This way, you know exactly how far they are apart .) Use a turn to face method to be sure the person is facing the table. Write a program to move the person to the table to get the food. Have the man show its thanks (for the food) by looking at the camera and waving an arm.


2-3

Open (or create) an island scene. Position the fish and the camera point of view so the scene appears as illustrated. Write a program that has the fish swim around in a circle in front of the island. Next, have the fish swim around the island. You may wish to have the fish move asSeenBy the island (asSeenBy is described in Tips & Techniques 2). Finally, have the fish jump out of the water and then dive down into the water.


Section 3

3-1

Create a world with a dog and a pole as shown in the scene below. Write an instruction that puts together a distance to function and a math expression to move the dog to the pole. The dog should stop short of colliding with it.  YOU MUST USE the function distance to


3-2

Create a world with a box and a gopher. Write a program to make the gopher hop to the top ofthe box, turning the legs backward and forward to make it look like a hop. Use the height function to guide the forward and up­ward movements.  YOU MUST USE the function height


3-3

This exercise creates a world with a man and a table, as seen below. Use a Loop to make the person move to the table in exactly 3 steps. Use a distance to function to the distance, you of course will need to use some math functions. We recommend that you test your solution by moving the person and the table to different locations on the screen and running the program with each change, so you can whether it works no matter where the two are located.  YOU MUST USE the function distance to


Section 4

4-1

An alien is on mars looking confused at a satellite dish. She stares at the sign for a few seconds and tilts her head sideways to show that she is confused. She then hops left and turns toward the sign and then hops right and turns toward the sign and then left and then right.

 Create a simulation that implements this comical story. Write methods hopLeft (alien turns left a small amount and hops, and then turns to face the sign) and hopRight (alien turns right a small amount and hops, then turns to face the sign). With each hop, the aliean should make some progress toward the sign. In my first method, alternately call the hopLeft and hopRight methods (twice) to make the alien take a zigzag path toward the sign.  YOU NEED TO HAVE 2 METHODS - hopLeft and hopRight


4-2

A magician is performing a levitation illusion, in which objects seem to rise magicallj into the air. The magician points a magic wand at his assistant , and she gently rises into the air and then floats back down to hel original position on the table (Furniture on CD or Web gallery). Then the magician per­forms the same trick with the rabbit (Animals). The rabbit, being a lighter object, float! up higher than the magician's assistant. Because the magician's assistant and rabbit ,levitate in the same way, use a single method and use parameters to communicate which object is to float and the distance the object is to move upward (and back down).  YOU NEED TO HAVE 1 METHOD - levitate that has 2 parameters (the object levitating and how high it levitates)

Hint: The magician's assistant is reclining on the surface of the table. A move up instruction will cause the assistant to move upward from her point of view, as shown below. Use the asSeenBy argument to make the magician's assistant move upward as seen by the ground.


4-3

Create a world with an ninja(People) and write class methods for traditional Ninja moves. For example, you can write rightjab and leftjab (where the Ninja jabs his hand upward with the appropriate hand), kickLeft and kickRight (where he kicks with the ap­propriate leg), and leftSpin and rightSpin (where he does a spin in the appropriate direc­tion). Each method must contain more than one instruction. For example, in the kickLeft method, the left lower leg should turn and the foot twist at the same time as the entire leg kicks out to the left. Save the Ninja as a new class named TrainedNinja. Start a new world and add two trainedNinja objects. Create an animation where the two trainedNin­ja objects practice their moves, facing one another.  YOU NEED TO HAVE 4 METHODS


4-4

Flight Simulator Completion

Create a world for a plane simulation.  

  • (a)Create the methods flyForward,barrel (roll around), flyLeft, flyRight, forwardLoop
  • (b) Implement the flyForward event when the user hits up.
  • (c) Add barrel event when the user hits space.
  • (d)  Add flyLeft andflyRight event handling methods for the left and right arrow keys to steer the biplane left or right.
  • (e)      Add a forwardLoop stunt that works when the user presses the Enter key.
  • Required - the 5 methods above

Section 5

5-1

Learning to type rapidly (without looking at the keyboard) is a skill requiring much practice. In this exercise, you are to create a typing tutor that encourages the begin­ning typist to type a specific set of letters. Use 3D text letters (3D Text folder) to cre­ate a word in the world, (for example, you could create the word ALICE with the letters A, L, I, C, and E) and create one method for all letters that spins the letter two times (so it will take in a parameter). When the user types a letter key on the keyboard that matches the letter on the screen, the letter on the screen should perform its spin method. Also include an ad­ditional method, spinWord, which spins all the letters when the user presses the spacebar. NOTE EACH LETTER WILL BE ITS OWN OBJECT

Requirements: 2 methods: spinLetter (taking in the letter as an object parameter) , spinWord

 Hint: Use asSeenBy to spin the word.


5-2

It's spring and you are anxiously waiting for flowers to grow. You decide to give them little help. Create an initial scene of a flowerbox (Box from Shapes, change color to red if you like) with four flowers (of your choosing) in it. (See instructions in the initial scene to move the flowers down out of sight.)

Write one method to grow a flower in the box (move the flower up into view). The flower that grows in the box depends, on which key the user presses , if the user presses "s" key, the sunflower will grow but if the user presses the "c" key, the cactus will grow. To grow the flowers, create a "When <key> is typed" event for each key selected to represent a specific flower. Link the key-press event to the growFlower event handling method, using the particular flower represented by that key as its parameter. When all the flowers are grown, the flowerbox will look something like the following:

Requirements: 1 method: growFlower (taking in the flower as an object parameter)


5-3

Snow Festival

Your team has created a snowman as the centerpiece of an entry in the Winter Snow Festival competition. To attract attraction to your display, you have set up colored spot­lights that will turn the color of the snowman anyone of four different colors. Create an initial world with four spotlights (spheres from the Shapes folder, of four different col­ors) and a snowman, as shown below. Write only one method to change the color of the snowman. When the user clicks on a spotlight pass the color of the spotlight to the method and make the snowman change to be that color.


5-4

A favorite activity of penguins in the local zoo is to slide down an icy slope into a pool of water in the pond. Create a world with a lake scene and three penguins (Animals) on the slope, as shown below. Make the program event-driven.  Allow the user to click on the next penguin to slide down the slope into the pool of water. Each penguin slides on its belly and spins around as it slides. Each penguin should spins some number of times. When the penguin reaches the pond, move the penguin down 5 rneters so it disappears below the water. Write only one event handling method. When the penguin is mouse-clicked, pass the penguin object that was clicked and the number of times the penguin is to spin around as it slides down the slope.    

Requirements: 1 method: slide (taking in the penguin as an object parameter, and spins asd a number parameter)

Section 6 EXTRA CREDIT

6-1 Extra Credit

Lightbulb

Create a world with a lightbulb (Lights) and a method turnOnOffthat turns the lig on/off depending on whether it is already on/off.