Bounce is now better

This commit is contained in:
2021-11-13 00:34:29 +01:00
parent 135f7d8a41
commit ae92c56957
6 changed files with 174 additions and 49 deletions

10
Bar.js
View File

@ -13,9 +13,9 @@ class Bar {
}
reset() {
this.x = (this.ctx.canvas.width - this.w) / 2;
this.y = (this.ctx.canvas.height - this.h * 2);
this._y = (this.ctx.canvas.height - this.h * 2);
this._y = this.ctx.canvas.height + 10;
this.y = this.ctx.canvas.height + 10;
}
update() {
this.move();
@ -46,10 +46,10 @@ class Bar {
draw() {
if (this._y != this.y) this._y--;
if (this._y < this.ctx.canvas.height) {
if (this.y != this._y) this.y--;
if (this.y < this.ctx.canvas.height) {
this.ctx.fillStyle = 'black';
this.ctx.fillRect(this.x, this._y, this.w, this.h);
this.ctx.fillRect(this.x, this.y, this.w, this.h);
}
}
}