breakout/brick.js

31 lines
433 B
JavaScript

Object.assign(self, {
collider: polygon2d.clone(),
char: char2d.clone({
flash:Resources.load("brick.png"),
}),
points: 50,
getshot() {
this.kill();
},
start() {
this.char.stop();
this.flash();
this.char.color = Color.Rainbow.red;
},
flash() {
this.char.play("flash");
},
collide(hit) {
if (hit.obj.from !== 'ball')
return;
this.powerup?.();
this.kill();
},
});