31 lines
508 B
JavaScript
31 lines
508 B
JavaScript
Object.assign(self, {
|
|
fallspeed: 150,
|
|
tag: "ball",
|
|
upgrade: function() {},
|
|
size: 12,
|
|
phys:1,
|
|
collider: circle2d.clone(),
|
|
color: Color.Rainbow.blue,
|
|
|
|
start() {
|
|
this.collider.radius = this.size;
|
|
this.collider.sensor = true;
|
|
},
|
|
|
|
draw() {
|
|
Shape.circle(this.pos,this.size,this.color);
|
|
},
|
|
|
|
collide(hit) {
|
|
if (!(hit.obj.from === 'paddle'))
|
|
return;
|
|
|
|
this.upgrade();
|
|
this.kill();
|
|
},
|
|
|
|
update(dt) {
|
|
this.pos = this.pos.add([0,-this.fallspeed*dt]);
|
|
},
|
|
});
|