3 Übung: Haus & Fenster

Bei dieser Aufgabe sollten wir mithilfe von Code, Hintergrund und Fenster einfärben. Es existierte bereits eine Vorlage und wir sollten uns hauptsächlich auf die Generierung der Fenster konzentrieren.

// The line below adds autocompletion for p5.js which is very Helpful /// // HELP: https://repl.it/@vogelino/P5js-Arrays-and-Objects // Here are the docs for P5.js: https://p5js.org/reference/ // The line below adds autocompletion for p5.js which is very Helpful /// // HELP: https://repl.it/@vogelino/P5js-Arrays-and-Objects // Here are the docs for P5.js: https://p5js.org/reference/ let windows = [0]; // ich glaube, hier muss viel mehr stehen.. function setup() { createCanvas(400, 600); background(255); drawHouse(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); drawWindow(); //das ist keinesfalls Ideal XD { fill(255,255,0) circle(30, 30, 20); } } function drawWindow(windowObject) { // window 1 fill(152,245,255) rect(150,150,100) // window 2 fill(152,245,255) rect(150,300,100) // window fill(152,245,255) rect(150,450,100) } function drawHouse() { let house = { w: 300, h: 500, x: 50, y: 100 } fill(200); noStroke(); rect(house.x, house.y, house.w, house.h) fill(150, 100, 20); triangle(house.x, house.y, width / 2, 0, house.x + house.w, house.y); }