You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zomburger/public/bank.js

43 lines
996 B
JavaScript

class Bank {
constructor(options) {
options = options || {};
this.position = {
x: options.x,
y: options.y
};
this.width = options.width;
this.height = options.height;
}
draw() {
let corner = {
x: this.position.x - this.width*0.5,
y: this.position.y - this.height*0.5
};
let half = {
width: this.width * 0.5,
height: this.height * 0.5,
};
tint(Colors.Eggplant);
let purple = color(Colors.Eggplant);
noFill();
stroke(purple);
strokeWeight(2);
rect(corner.x, corner.y, this.width, this.height);
image(Images.bank, corner.x, corner.y, this.width, this.height);
if (debug) {
strokeWeight(4);
stroke('#FF0000');
point(this.position.x, this.position.y);
strokeWeight(1);
noFill();
rect(corner.x, corner.y, this.width, this.height);
}
}
}
Bank.prototype.bounds = bounds;
Bank.prototype.outOfBounds = outOfBounds;
Bank.prototype.overlaps = overlaps;