Angry Birds (Part 5) (Pig2.js)

 Angry Birds

(Part 5)


Pig2.js:

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

  display() {
    if (this.body.speed < 4) {
      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: