Skip to content

Commit c099efe

Browse files
committed
new Hurdle Class
1 parent e0a9498 commit c099efe

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
</html>
1919
<script src="js/oscillator.js"></script>
2020
<script src="js/roundHurdle.js"></script>
21+
<script src="js/blockHurdle.js"></script>
2122
<script src="js/constant.js"></script>
2223
<script src="js/helper.js"></script>
2324
<script src="js/index.js"></script>
25+

js/blockHurdle.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class BlockHurdle {
2+
3+
constructor(x, y, width, height = 20,color="blue") {
4+
this.x = x;
5+
this.y = y;
6+
this.width = width;
7+
this.height = height;
8+
this.color = color;
9+
}
10+
11+
draw() {
12+
ctx.beginPath();
13+
ctx.fillStyle = this.color;
14+
ctx.rect(this.x, this.y, this.width, this.height);
15+
ctx.fill();
16+
ctx.stroke();
17+
}
18+
}

0 commit comments

Comments
 (0)