Project 11: Landscape

sketch
 /*
 Bon Bhakdibhumi
 bbhakdib
 Section D
 */
var backgroundX = 355;
var foregroundX = 250;
function preload() {
    train = loadImage("https://i.imgur.com/cMqi4AV.png");
    house = loadImage("https://i.imgur.com/KrNQaN2.png");
    tower = loadImage("https://i.imgur.com/P6WEAeL.png");
    montain = loadImage("https://i.imgur.com/04duSGs.png");
    backgroundHouse = loadImage("https://i.imgur.com/DgMNstF.png");
    backgroundTower = loadImage("https://i.imgur.com/AuMqECF.png");
}

 function setup() {
    createCanvas(480, 240);
 }

 function draw() {
// backdrop
    noStroke();
    fill(147, 129, 101);
    rect(0, 175, 480, 65);
    fill(164, 233, 244);
    rect(0, 0, 480, 174);
    imageMode(CENTER);
// background elements
    for (var i = 0; i < 3; i ++) {
        image(backgroundTower, backgroundX - (i * 200), 117, 200, 200);
        image(backgroundHouse, (backgroundX + 80) - (i * 200), 147, 200, 200);
    }
// foreground elements
    image(montain, foregroundX, 105, 250, 250);
    image(house, foregroundX - 140, 137, 210, 210);
    image(tower, foregroundX + 130, 105.5, 210, 210);
    image(train, 240, 120, 480, 240);
    backgroundX -= 2; 
    foregroundX -= 2;
// resetting foreground and background elements
    if (backgroundX <= -125) {
        backgroundX = 900;
    }

    if (foregroundX <= -150) {
        foregroundX = 825
    }
}

For this project, I chose to make a landscape of a town I visited by train for the first time.

Leave a Reply