We are about to switch to a new forum software. Until then we have removed the registration on this forum.
EDIT: It didn't stop working for no reason, I actually edited img3 = loadImage("3.jpg");
and forgot about it, "3.jpg" doesn't exist, lol.
I managed to make the images move across the screen, but then I wanted the images side by side instead of on top of each other, so I changed image(this.nr, this.start, 0);
to image(this.nr, this.start+width, 0);
to image(this.nr, this.start+(width*this.nr), 0);
this.nr
is the first var in these lines: slider = new Slider(0,img0);
So I was changing it to and fro, trying to make it work and all of a sudden it said "1426(or something): (something about not being able to load the image or something)", So I saved the sketch, restartet the program and now there's no error, but when I run the sketch it says "loading..." in the middle of the screen.
Here is my sketch.js:
var img1,img2, img0, img3;
var slider;
function preload(){
img0 = loadImage("0.jpg");
img1 = loadImage("1.jpg");
img2 = loadImage("2.jpg");
img3 = loadImage("3.jpg");
}
function setup(){
createCanvas(800,600);
slider = new Slider(0,img0);
slider1 = new Slider(1,img1);
slider2 = new Slider(2,img2);
slider3 = new Slider(3,img3);
//mover = new Mover();
}
function draw(){
background(60);
slider.update();
slider1.update();
slider2.update();
slider3.update();
slider.display();
slider1.display();
slider2.display();
slider3.display();
//mover.display();
print(slider.c);
}
And here is the function I was working on in slider.js:
this.display = function() {
stroke(255);
fill(this.p);
rect(this.start + (width * this.nr), 0, width, height);
this.test += 1
image(this.nr, this.start, 0);
};
Answers
solved?
Yes