Skip to content

Commit cc4aa9d

Browse files
committed
Section 22: Drawing Vertical Segments
1 parent 43abbab commit cc4aa9d

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

22-Javascript-with-the-Canvas-API/02-Maze copy/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,23 @@ horizontals.forEach((row, rowIndex) => {
141141
)
142142
World.add(world, wall)
143143
})
144+
})
145+
146+
verticals.forEach((row, rowIndex) => {
147+
row.forEach((open, columnIndex) => {
148+
if(open) {
149+
return
150+
}
151+
152+
const wall = Bodies.rectangle(
153+
columnIndex * unitLength + unitLength,
154+
rowIndex * unitLength + unitLength / 2,
155+
10,
156+
unitLength,
157+
{
158+
isStatic: true
159+
}
160+
)
161+
World.add(world, wall)
162+
})
144163
})

22-Javascript-with-the-Canvas-API/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@ console.log(grid)
7575

7676
## 18. 22 Iterating Over Walls
7777

78-
## 19. 23 Drawing Horizontal Segments
78+
## 19. 23 Drawing Horizontal Segments
79+
80+
## 20. 24 Drawing Vertical Segments
81+
82+
## 21. 25 Drawing the Goal

0 commit comments

Comments
 (0)