Skip to content

Commit cf89944

Browse files
committed
Section 22: Configuration Variables
1 parent 533b41f commit cf89944

5 files changed

Lines changed: 44 additions & 2 deletions

File tree

File renamed without changes.
File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.19.0/matter.min.js"></script>
7+
<title>Maze</title>
8+
</head>
9+
<body>
10+
<script src="index.js"></script>
11+
</body>
12+
</html>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Matter.js library
2+
const { Engine, Render, Runner, World, Bodies } = Matter
3+
4+
const width = 600
5+
const height = 600
6+
7+
const engine = Engine.create()
8+
const { world } = engine
9+
const render = Render.create({
10+
element: document.body,
11+
engine: engine,
12+
options: {
13+
wireframes: true,
14+
width,
15+
height,
16+
},
17+
})
18+
19+
Render.run(render)
20+
Runner.run(Runner.create(), engine)
21+
22+
// Walls
23+
const walls = [
24+
Bodies.rectangle(width / 2, 0, width, 40, { isStatic: true }),
25+
Bodies.rectangle(width / 2, height, width, 40, { isStatic: true }),
26+
Bodies.rectangle(0, height / 2, 40, height, { isStatic: true }),
27+
Bodies.rectangle(width, height / 2, 40, height, { isStatic: true }),
28+
]
29+
30+
World.add(world, walls)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ World.add(world, shape)
3030

3131
## 6. 08 Generating Random Shapes
3232

33-
## 7. 09 Maze Generation Algorithm
34-
33+
## 7. 11 Configuration Variables
3534

35+
**folder 02**

0 commit comments

Comments
 (0)