xxxxxxxxxx
24
// Street Class
function Street() {
// Set pos
this.pos = createVector(width / 2, height / 8);
// Set size
this.r = createVector(width * 1.75, height * 1.75);
// Render street
this.render = function () {
push();
translate(this.pos.x, this.pos.y);
image(img[6], -this.r.x / 2, -this.r.y / 2, this.r.x, this.r.y);
pop();
}
// Street update
this.update = function () {
this.pos.y += vel;
if (this.pos.y > height / 1.92) {
this.pos.y = height / 8;
}
}
}