function Light(x, y, xWidth, yWidth) { this.position = createVector(x, y) this.state = red this.xWidth = xWidth this.yWidth = yWidth this.display = function() { colorMode(HSB); if (this.state = red) { fill(0, 100, 100) } else { fill(255, 100, 100) } noFill() stroke(0, 0, 0) rect(this.position.x - this.xWidth, this.position.y - this.yWidth, this.xWidth * 2, this.yWidth * 2) } }