Added bricks type 2 and 3

This commit is contained in:
2021-11-15 00:29:50 +01:00
parent 7cf0bfbdbd
commit e0ebef2a27
3 changed files with 37 additions and 21 deletions

View File

@ -53,10 +53,10 @@ class GamePlay extends Board {
let r = ball.update(this.ctx, this.bar.x + this.bar.w/2, this.bar.y);
ball.collide( this.bar.x, this.bar.y, this.bar.x + this.bar.w, this.bar.y + this.bar.h );
this.bricks.forEach(b=>{
if(b.alive){
if(b.lives>0){
if ( ball.collide(b.x,b.y,b.x+b.w,b.y+b.h) ) {
this.score.add(1);
b.alive = false;
b.crack();
}
}});