Added sprites to the bricks and touch control

This commit is contained in:
2021-11-17 20:12:25 +01:00
parent bc3ef31728
commit 44e93e5c6d
9 changed files with 83 additions and 30 deletions

View File

@ -8,7 +8,9 @@ class Board {
this.y = ctx.canvas.height / 2 - 48;
this.w = this.ctx.canvas.width;
this.h = this.ctx.canvas.height
this.h = this.ctx.canvas.height;
this.img = resources.get('bg01');
}
run() {
@ -45,7 +47,8 @@ class Board {
loop() {
if (this.stop) return;
this.ctx.clearRect(0, 0, this.w, this.h);
// this.ctx.clearRect(0, 0, this.w, this.h);
this.ctx.drawImage(this.img, 0, 0);
this.update();
this.requestID = requestAnimationFrame( ()=>this.loop() );
}