I had some significant trouble working with some of my variables and conditional logic. Also for an added bonus I was adding a png file and an audio file to try something that I hadn’t done before.
First the image wouldn’t load, but that was down to me referencing the file from the wrong folder path.
Second the music wouldn’t play which was due another error on my part of not using all of the reference code for the loadSound function.
Keep plugging away and asking questions and eventually you come across the answer.
Here’s the code. I am not giving out the associated files, I don’t want to ruin the surprise.
function preload() {
img = loadImage(“./assets/le-logo-du-poing-leve-des-black-panther.png”);
mySound = loadSound(‘./assets/Steel Pulse – Uncle George.mp3’);
}
var x, y;
//word loc is word location x
//worloc2 is word location y
//ts is text size
var wordloc = -5
var wordloc2 = 400
var ts = 8
function setup() {
createCanvas(1920, 1080);
frameRate(120)
mySound.setVolume(0.1);
mySound.play();
}
function draw() {
// On mouse click change bg color for a sexy party
// Display moving text that says “power to the people”
{
background(random(225, 255), 100, random(50, 150));
image(img, 500, 200);
textSize(ts);
ts++
stroke(0, 10)
text(“Power to the People”, wordloc, wordloc2 – 1);
fill(150);
text(“Power to the People”, wordloc, wordloc2 – 1);
fill(150);
text(“Power to the People”, wordloc, wordloc2 – 1);
fill(150);
text(“Power to the People”, wordloc, wordloc2 – 1);
if (frameCount >= 127) {
ts = 150
}
}
}