Skip to content

Commit 8dedcea

Browse files
committed
updated English for ManyAnimals
1 parent 110745a commit 8dedcea

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed
0 Bytes
Binary file not shown.

TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/ManyAnimals.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,47 @@ public ManyAnimals()
1212
{
1313
showSomeTurtles();
1414
}
15-
//create an ArrayList of Turtle Objects
15+
//create container for Turtles HINT: Use ArrayList
1616
public ArrayList<Turtle> turtles = new ArrayList<Turtle>();
17-
//create a window for many turtles
17+
//create a window for many turtles HINT: Use MultiTurtlePanel
1818
public MultiTurtlePanel mt = new MultiTurtlePanel();
1919
private void showSomeTurtles()
2020
{
21+
//show the panel
2122
mt.showPanel();
22-
//Have SimpleBubble listen for when the left mouse button is clicked in your program window
23+
//listen for left mouse button click
2324
//mt.addMouseLeftClickListener(this);
25+
//set the size to 100
2426
int size = 100;
25-
//add three turtles
27+
//add three turtles HINT: Use a For loop
2628
for (int i = 1; i <= 3; i++)
2729
{
2830
//create a turtle
2931
Turtle turtle = new Turtle();
30-
//add the turtles to the turtles
32+
//add the turtles to the container for turtles
3133
turtles.add(turtle);
3234
}
33-
//add all the turtles to the window
35+
//add all turtles to the window HINT: Use a FOR loop
3436
for (Turtle turtle : turtles)
3537
{
36-
//must call addTurtle BEFORE calling other methods
37-
//add the first turtle to the windows
38+
//NOTE: must call addTurtle BEFORE calling other methods
39+
//add all turtles to the window
3840
mt.addTurtle(turtle);
3941
}
40-
//set the X, Y - teleport
42+
//teleport all turtles on the window HINT: Use a FOR loop and ZERO
4143
for (int i = 0; i < 3; i++)
4244
{
45+
//set the X position to i*100 + 350
4346
turtles.get(i).setX(i * 100 + 350);
47+
//set the Y position to i*100 + 100
4448
turtles.get(i).setY(i * 100 + 100);
4549
}
50+
//set some values for all turtles HINT: Use a FOR loop
4651
for (Turtle turtle : turtles)
4752
{
48-
//have the first Turtle draw a star
53+
//set the speed of all turtle's to 7
4954
turtle.setSpeed(7);
55+
//have every turtle draw a star of the current size
5056
turtle.drawStar(size);
5157
}
5258
}

0 commit comments

Comments
 (0)