forked from itscodenation/tinyTurtleUnit10Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
65 lines (57 loc) · 1008 Bytes
/
script.js
File metadata and controls
65 lines (57 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
TinyTurtle.apply(window);
penStyle = 'green';
function triangle(x){
right(45);
forward(x);
right(90);
forward(x);
right(135);
forward(x);
}
function house(y){
square(y);
triangle(y);
}
function pentagon(w){
for(var i = 0; i <= 5; i++){
forward(w);
right(72);
}
}
function hexagon(v){
for(var i = 0; i <= 6; i++){
forward(v);
right(60);
}
}
function square(width) {
forward(width);
right(90);
forward(width);
right(90);
forward(width);
right(90);
forward(width);
right(90);
}
function rotatedSquare(width, angle){
for(var i=0; i<(width/10); i ++){
square(width-(10*i));
left(angle);
//change by even and odd
}
}
function shape(size, angle){
for(var i = 0; i < (360/angle); i++){
forward(size);
right(angle);
}
}
//rotatedSquare(70, 50);
shape(20, 67);
// Type your function call below
/*square(10);
triangle(15);
house(18);
pentagon(20);
hexagon(30);*/