Angry Birds
(Part 3)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5ArLfOCoXfoJep5oyFBy0F0Kzo4DbZB5FQwuXcsR-WRaUyc8LU5TvDstiZf20XOifr-NEr_DPafxYXm2r_HlUJ_08uhA2DYt5GKKlRB7EapsIo4ppc9tofxNaB0j-FkalOG1M4KRRAL8r/w400-h225/Part+3.png)
BaseClass.js:
class BaseClass {
constructor(x, y, w, h, angle) {
var options = {
restitution: 0.3,
friction: 1.0,
density: 1.0,
};
this.body = Bodies.rectangle(x, y, w, h, options);
this.width = w;
this.height = h;
this.image = loadImage('sprites/base.png');
World.add(world, this.body);
}
display() {
var angle = this.body.angle;
push();
translate(this.body.position.x, this.body.position.y);
rotate(angle);
imageMode(CENTER);
image(this.image, 0, 0, this.width, this.height);
pop();
}
}
0 Comments: