Added the bricks (and improve the bouncing)

This commit is contained in:
2021-11-14 23:49:49 +01:00
parent 0f4a403edb
commit 7493713529
12 changed files with 303 additions and 111 deletions

5
Bar.js
View File

@ -3,14 +3,15 @@ class Bar {
this.ctx = ctx;
this.key = key;
this.w = 100;
this.h = 20;
this.w = 80;
this.h = 15;
this.speed = 10; // Target Speed
this._speed = 0; // Current Speed and direction
this.xLimit = (ctx.canvas.width - this.w);
this.reset();
}
reset() {
this.x = (this.ctx.canvas.width - this.w) / 2;
this._y = (this.ctx.canvas.height - this.h * 2);