Bounce is now better
This commit is contained in:
10
Bar.js
10
Bar.js
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user