Angry Birds
(Part 2)
Ground.js:
class Ground {
constructor(x, y, w, h) {
var options = {
isStatic: true,
};
this.body = Bodies.rectangle(x, y, w, h, options);
this.width = w;
this.height = h;
World.add(world, this.body);
}
display() {
var pos = this.body.position;
rectMode(CENTER);
fill('brown');
rect(pos.x, pos.y, this.width, this.height);
}
}
0 Comments: