just my lil German boy
// Sowang Kundeling Section C Project 11
var backgroundX = 355;
var foregroundX = 250;
function preload() {
germanboy = loadImage("https://i.imgur.com/8g7kXHX.png");
neighborhood = loadImage("https://i.imgur.com/ueqfD0Q.png");
house = loadImage("https://i.imgur.com/VeVnWaO.png");
montain = loadImage("https://i.imgur.com/xImWYKs.png");
long = loadImage("https://i.imgur.com/6kAoEti.png");
short = loadImage("https://i.imgur.com/hGhArWq.png");
}
function setup() {
createCanvas(480, 240);
}
function draw() {
// sky
noStroke();
fill(180, 227, 242);
rect(0, 0, 480, 25); // x7
fill(163, 194, 207);
rect(0, 25, 480, 25);
fill(137, 165, 176);
rect(0, 50, 480, 25);
fill(121, 146, 156);
rect(0, 75, 480, 25);
fill(98, 119, 128);
rect(0, 100, 480, 25);
fill(79, 95, 102);
rect(0, 125, 480, 25);
fill(60, 74, 79);
rect(0, 150, 480, 25);
imageMode(CENTER);
// background elements
for (var i = 0; i < 2; i ++) {
image(short, backgroundX - (i * 150), 159, short.width/2, short.height/2);
image(long, (backgroundX + 90) - (i * 200), 145, long.width/2, long.height/2);
}
// land
fill(107, 96, 81);
rect(0, 175, 480, 65); // land
// foreground elements
image(montain, foregroundX-120, 115, 265, montain.width/4, montain.height/4);
image(neighborhood, foregroundX - 140, 137, neighborhood.width/2, neighborhood.height/2);
image(house, foregroundX + 250, 140, house.width/4, house.height/4);
image(germanboy, 100, 200, germanboy.width/2, germanboy.height/2);
backgroundX -= 1;
foregroundX -= 1;
// reset
if (backgroundX <= -300) {
backgroundX = 900;
}
if (foregroundX <= -300) {
foregroundX = 825
}
}