-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek_1.js
More file actions
50 lines (41 loc) · 918 Bytes
/
week_1.js
File metadata and controls
50 lines (41 loc) · 918 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
const width = 125;
const height = 125;
setDocDimensions(width, height);
const finalLines = [];
const rad = bt.randIntInRange(10, 30);
const len = bt.randIntInRange(10, 100);
const x_pos = bt.randIntInRange(10, 90);
drawLines([
[
[0,20],
[125,20]
]
])
const building = new bt.Turtle()
.jump([x_pos, 20])
.left(90)
.forward(len)
.right(90)
.forward(rad)
.right(90)
.forward(len)
.right(90);
const bird = new bt.Turtle()
.setAngle(bt.randIntInRange(-20, 20))
.jump([rad, len+10])
.arc(-35,8)
.right(-45)
.arc(-35,8);
const bird2 = new bt.Turtle()
.setAngle(bt.randIntInRange(-20, 20))
.jump([rad+60, len+20])
.arc(-35,8)
.right(-45)
.arc(-35,8);
const building_path = building.path;
finalLines.push(building_path[0]);
const bird_path = bird.path;
const bird2_path = bird2.path;
finalLines.push(bird_path[0]);
finalLines.push(bird2_path[0]);
drawLines(finalLines);