Hello,
i know the problem, because i often developed small scroll games, and for normal you give your class, which represents the whole ‘level’ an PVector ‘shift’. If you aren’t working with classes, it should be possible to create a global variable for this.
A little example what i mean:
PVector shift;
PImage background;
void setup() {
shift = new PVector(0, 0); // The start of the background (upper-left corner)
background = loadImage("background.png"); // Or whatever your background is
}
void draw() {
background(255); // Is actually not needed because you have an image.
image(background, shift.x, shift.y);
}
void keyPressed() {
if (key == 'a') {
shift.x += 1;
} else if(key == 'd') {...
}