sketch
// Sarita Chen
// Section A
// slchen@andrew.cmu.edu
// Project: Wallpaper
function setup() {
createCanvas(600, 600);
noLoop();
}
function draw() {
background(90,230,255); // Blue.
for(var x = 0; x < width + 4; x +=60){
for(var y = 0; y < height; y += 80){
luigi(x,y); // draws the function "luigi"
}
}
}
// luigi design
function luigi(x,y) {
noStroke();
var hairC = ('YellowGreen');
var skintone = ('Orange');
var clothes = (255);
var buttons = ('Gold');
var pixel = 2.5;
// Note: the side comments refer to the number of squares each line
// produces.
// Line 1
fill(clothes);
rect(x+10*pixel,y,pixel*5,pixel); //
// Line 2
fill(clothes);
rect(x+9*pixel,y+pixel,pixel*9,pixel); // 9 white
//Line 3
fill(hairC);
rect(x+9*pixel,y+pixel*2,pixel*3,pixel); // 3 green
fill(skintone);
rect(x+12*pixel,y+pixel*2,pixel*2,pixel); //2 orange
fill(hairC);
rect(x+14*pixel,y+pixel*2,pixel,pixel); // 2 green
fill(skintone);
rect(x+15*pixel,y+pixel*2,pixel,pixel); // 1 orange
//Line 4
fill(hairC);
rect(x+8*pixel,y+pixel*3,pixel,pixel); // 1 green
fill(skintone);
rect(x+9*pixel,y+pixel*3,pixel,pixel); // 1 orange
fill(hairC);
rect(x+10*pixel,y+pixel*3,pixel,pixel); // 1 green
fill(skintone);
rect(x+11*pixel,y+pixel*3,pixel*3,pixel); // 3 orange
fill(hairC);
rect(x+14*pixel,y+pixel*3,pixel,pixel); // 1 green
fill(skintone);
rect(x+15*pixel,y+pixel*3,pixel*3,pixel); // 3 orange
//Line 5
fill(hairC);
rect(x+8*pixel,y+pixel*4,pixel,pixel); // 1 green
fill(skintone);
rect(x+9*pixel,y+pixel*4,pixel,pixel); // 1 orange
fill(hairC);
rect(x+10*pixel,y+pixel*4,pixel*2,pixel); // 2 green
fill(skintone);
rect(x+12*pixel,y+pixel*4,pixel*3,pixel); // 3 orange
fill(hairC);
rect(x+15*pixel,y+pixel*4,pixel,pixel); // 1 green
fill(skintone);
rect(x+16*pixel,y+pixel*4,pixel*3,pixel); //3 orange
// Line 6
fill(hairC);
rect(x+8*pixel,y+pixel*5,pixel*2,pixel); // 2 green
fill(skintone);
rect(x+10*pixel,y+pixel*5,pixel*4,pixel); // 4 orange
fill(hairC);
rect(x+14*pixel,y+pixel*5,pixel*4,pixel); // 4 green
fill(skintone);
rect(x+10*pixel,y+pixel*6,pixel*7,pixel); // 7 orange
//Line 8
fill(hairC);
rect(x+9*pixel,y+pixel*7,pixel*2,pixel); // 2 green
fill(clothes);
rect(x+11*pixel,y+pixel*7,pixel,pixel); // 1 white
fill(hairC);
rect(x+12*pixel,y+pixel*7,pixel*3,pixel); // 3 green
//Line 9
fill(hairC);
rect(x+8*pixel,y+pixel*8,pixel*3,pixel); // 3 green
fill(clothes);
rect(x+11*pixel,y+pixel*8,pixel,pixel); // 1 white
fill(hairC);
rect(x+12*pixel,y+pixel*8,pixel*2,pixel); // 2 green
fill(clothes);
rect(x+14*pixel,y+pixel*8,pixel,pixel); // 1 white
fill(hairC);
rect(x+15*pixel,y+pixel*8,pixel*3,pixel); // 3 green
//Line 10
fill(hairC);
rect(x+7*pixel,y+pixel*9,pixel*4,pixel); // 4 green
fill(clothes);
rect(x+11*pixel,y+pixel*9,pixel*4,pixel); // 4 white
fill(hairC);
rect(x+15*pixel,y+pixel*9,pixel*4,pixel); // 4 green
// Line 11
fill(skintone);
rect(x+7*pixel,y+pixel*10,pixel*2,pixel); // 2 orange
fill(hairC);
rect(x+9*pixel,y+pixel*10,pixel,pixel); // 1 green
fill(clothes);
rect(x+10*pixel,y+pixel*10,pixel,pixel); // 1 white
fill(buttons);
rect(x+11*pixel,y+pixel*10,pixel,pixel); // 1 yellow
fill(clothes);
rect(x+12*pixel,y+pixel*10,pixel*2,pixel); // 2 white
fill(buttons);
rect(x+14*pixel,y+pixel*10,pixel,pixel); // 1 yellow
fill(clothes);
rect(x+15*pixel,y+pixel*10,pixel,pixel); // 1 white
fill(hairC);
rect(x+16*pixel,y+pixel*10,pixel,pixel); // 1 green
fill(skintone);
rect(x+17*pixel,y+pixel*10,pixel*2,pixel); // 2 orange
//Line 12
fill(skintone);
rect(x+7*pixel,y+pixel*11,pixel*3,pixel); // 3 orange
fill(clothes);
rect(x+10*pixel,y+pixel*11,pixel*6,pixel); // 6 white
fill(skintone);
rect(x+16*pixel,y+pixel*11,pixel*3,pixel); // 3 orange
// Line 13
fill(skintone);
rect(x+7*pixel,y+pixel*12,pixel*2,pixel); // 2 orange
fill(clothes);
rect(x+9*pixel,y+pixel*12,pixel*8,pixel); // 8 white
fill(skintone);
rect(x+17*pixel,y+pixel*12,pixel*2,pixel); // 2 orange
// Line 14
fill(clothes);
rect(x+9*pixel,y+pixel*13,pixel*3,pixel); // 3 white
fill(clothes);
rect(x+14*pixel,y+pixel*13,pixel*3,pixel); // 3 white
// Line 15
fill(hairC);
rect(x+8*pixel,y+pixel*14,pixel*3,pixel); // 3 green
fill(hairC);
rect(x+15*pixel,y+pixel*14,pixel*3,pixel); // 3 green
// Line 16
fill(hairC);
rect(x+7*pixel,y+pixel*15,pixel*4,pixel); // 4 green
fill(hairC);
rect(x+15*pixel,y+pixel*15,pixel*4,pixel); // 4 green
}
I wanted to make my wallpaper 8bit style, so I decided to recreate an 8bit version of Luigi from the older Super Mario games. I used an image I found here, which made it convenient as I could easily count the number of “pixels” used to create the image. Actually making the Luigi function took up the most time, because I had initially started off by having a for loop generate the squares for each line.That actually made it harder for me to put the function in a for loop to generate the wallpaper, because it was too many variables to handle so I had to go back and reedit everything… Anyways, I’m happy with the final result! I tried to make the colours as vibrant as possible, since Super Mario is a very bright, cheerful game.