Angry Birds (Part 5) (Pig1.js)

 Angry Birds

(Part 5)

 


Pig1.js:

class Pig1 extends BaseClass {
  constructor(x, y) {
    super(x, y, 5050);
    this.image = loadImage('sprites/Pgi.png');
    this.image2 = loadImage('sprites/pgiout2.png');
    this.visiblity = 255;
  }

  display() {
    if (this.body.speed < 3) {
      super.display();
    } else {
      World.remove(world, this.body);
      push();
      this.visiblity = this.visiblity - 2;
      tint(255this.visiblity);
      image(this.image2, this.body.position.x, this.body.position.y, 5050);
      pop();
    }
  }
}

0 Comments: