function Cloud() { this.x = logicalWidth; this.y = random(20, logicalHeight / 2); // Keep clouds in the upper half this.width = 50; this.height = 30; this.update = function() { this.x += movementVelocity * 0.5; // Clouds move slower } this.offscreen = function() { return this.x < -this.width; } this.show = function() { if (cloud_img) { image(cloud_img, this.x, this.y, this.width, this.height); } } }