Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Lab 10 Doing Things Over and Over (counted loops

and nested loops)


This work is licenced under a Creative Commons Attribution-NonCommercial-ShareAlike
3.0 Unported License
Original Authors: Beth Simon and Sarah Esper
Modified by Juan Ramirez

Learning Goals: Students will...


● Use a for-loop to make an object repeat a set of actions a certain number of times.
● Use nested loops to make repeated things happen in more complicated ways.

You will be designing and implementing a rescue operation where a helicopter will be attempting to
rescue a drowning girl.

You will start by downloading this world Mod10LabStarter.a2w.

This lab is broken up into 3 parts:


● The helicopter circles the victim: The helicopter should "circle" the girl overhead.
● Make the scene more realistic: The girl should bob in the water and the helicopter's propellers should
spin.
● Create your own ending to the story.

AS YOU WORK ON THIS LAB, INCLUDE SIMPLE COMMENTS TO EXPLAIN WHAT THE CODE IS DOING
(Short phrases are usually sufficient).

YOU WILL SUBMIT THE ALICE WORLD FILE AND A SHAREABLE LINK TO YOUR COPY OF THE LAB WITH
THE QUESTIONS AT THE BOTTOM ANSWERED.

Part 1: Helicopter Circles Victim


This part has three subparts that you need to build:
● Take Off: The helicopter should "take off" from the helipad. (Note: a good height is about 4 meters).
● Circle: The helicopter should "circle" the girl from above, this means it should move in a square around
her. (Note: a good area is about 100 meters (10 meters each side))
● Land: The helicopter should "land" back on the helipad.

Part 2: Make the scene more realistic


In this part you are trying to make your scene more realistic, like this video here. To do this you need to add
three things:
● Propellers: The two propellers on the helicopter (propeller and backRotor) should spin forever.
● Victim: The victim should bob (move up and down) twice for each side of the square that the helicopter
travels.
● You Choose: You need to add one more "realistic" aspect to this scene. For example: The victim's arms
can move when she bobs or the helicopter can sway back and forth as if there are strong winds while
it flies.Whatever you add should use a nested loop. (This can be adding a loop to one that is already in
the scene, or adding two new nested loops).

(NOTE: You will need to use a combination of loops, nested loops, DoTogether tiles and DoInOrder tiles
for this part).
● Create your own ending. Make it interesting.

Finishing
1. Describe the nested loop to get the girl to bob (move up and down) while the helicopter is moving.

I looped the girl bobbing up and down 2 times inside of a 4 times loop which means that the girl will bob up
and down a total of 8 times

2. Describe the feature that you added that had a nested loop.

I added an arms splash method which is looped with the bob method

3. When are nested loops useful? Provide an example of another time when you might need nested
loops.

Nested loops are useful when you need to code multiple objects that are repeatedly moving at the same time.
For example, you would use a nested loop when a windmill wheel is spinning while a person jumps up and
down

You might also like