Hello, I’m new to coding and am working on my assessment to school and am stuck with loops and an event statement. I only need to fix the lines so they don’t disappear and fix the color when a mouse is pressed. Please please please can you help me out?
“`
var statement = [‘I’, ‘cannot’, ‘code’, ‘but’, ‘I’ , ‘am’, ‘doing’, ‘my’, ‘best’, ‘:)’];
let value = 255;
var index = 0;
function setup() {
createCanvas(600, 600);
frameRate(1);
}
function draw() {
background(0);
stroke(0);
stroke(255);
for (let lineX = 35; lineX <= 600; lineX += 35) {
line(lineX, 0, lineX, height);
}
fill(value);
stroke(1);
strokeWeight(0);
rect(175, 225, 250, 120);
fill(0);
textAlign(CENTER);
textSize(50);
text(statement[index], 300, 300);
index++;
if (mouseIsPressed) {
if (value === 255) {
value = 66;
} else {
value = 255;
}
}
}
if (index > 10) {
index = 0;
}