I am just beginner and I am doing little bit exercise with p5.js. So please bear with me if my code is such a mess.
I made multiple gameboy with random flickering screen and now I want to make another random color for the skin as well but I wanted to make it static.
function setup() {
createCanvas(600, 400);
colorMode(HSB, 100, 100);
rectMode(CENTER);
noStroke();
frameRate(40);
}
function gameboy() {
//shadow
fill(221, 30, 100);
rect(70, 95, 66, 93, 5);
//body
fill(31, 87, 96);
rect(78, 90, 66, 93, 5);
fill(55, 80, 90);
rect(87, 90, 66, 93, 5);
//screen
fill(240, 1, 25);
rect(88, 70, 55, 44, 5);
fill(random(100,260), 100, 100);
rect(90, 70, 35, 33, 2);
//screen white
fill(random(200,357), 87, 92);
ellipse(66, 66, 3, 3);
//buttons
fill(240, 1, 25);
rect(75, 112, 6, 17, 5);
rect(75, 112, 17, 6, 5);
fill(240, 1, 25);
ellipse(102, 114, 8, 8);
ellipse(112, 109, 8, 8);
}
function draw() {
background(224, 6, 100);
for (x = 0; x <= width - 130; x += 130) {
for (y = 0; y <= height - 130; y += 130) {
push();
translate(x, y);
rotate(6);
gameboy();
pop();
}
}
}
Any idea?
Please help