previous

page 17

next

Try this in the JavaScript Console.

Note the curly brackets instead
of square brackets.

So the whole associative array is:

{colr:'black', x:400, y:400, h:0, width:2, pen:'down'}

We can access any part of the array by using the dot notation
For example, try t.width.

So how do we use this turtle?

We'll need to rewrite fd and rt:

rt()
function rt(t,angle) {
t.h=t.h+angle;
t.h=t.h%360;
}

fd on the next page →

previous
next