Added the bricks (and improve the bouncing)
This commit is contained in:
5
Bar.js
5
Bar.js
@ -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);
|
||||
|
Reference in New Issue
Block a user