Passing a variable to image()
in
Programming Questions
•
1 year ago
Hi and apologies before hand if the question is too basic or has been asked before.
I'm trying to make a lateral scroll loading a very wide pic and moving it. Something like this :
I get the error 'Cannot find anything named "back_x". If I put back_x in draw() I have to initialize it, so it won't help...
How can I do it ? Or maybe my approach is totally wrong.... I bet is something really basic.
Thanks in advance.
I'm trying to make a lateral scroll loading a very wide pic and moving it. Something like this :
PImage f;
void setup(){
size(500,300);
f = loadImage("backstage.png");
int back_x = 0;
}
void draw(){
image(f,back_x,0);
back_x--;
}
I get the error 'Cannot find anything named "back_x". If I put back_x in draw() I have to initialize it, so it won't help...
How can I do it ? Or maybe my approach is totally wrong.... I bet is something really basic.
Thanks in advance.
1