
previous

page 19
next
Two turtles
function test() {
var t1=turtle('red');
for (var i=0; i<4; i++) {
fd(t1,300); rt(t1,90);
}
var t2=turtle('green');
t2.x=50; t2.y=750;
for (var i=0; i<4; i++) {
fd(t2,300); rt(t2,90);
}
}
var t1=turtle('red');
for (var i=0; i<4; i++) {
fd(t1,300); rt(t1,90);
}
var t2=turtle('green');
t2.x=50; t2.y=750;
for (var i=0; i<4; i++) {
fd(t2,300); rt(t2,90);
}
}
Our my.js file is starting to get rather lengthy so it may be useful to show you another great Atom feature.
While looking at my.js in Atom, from the Edit drop-down list choose Folding and then Fold All.
Neat, eh?
Click on the > to the left of function to open that function out again.
previous
next