Galaga scrolling background

I have to create a project in which I chose to create Galaga. I want a vertically scrolling background but don’t know how to achieve that. How would you guys go about something like that?

The code below is from the Fun Programming blog maintained by hamoid (aBe). I only changed the direction. There are a lot of tutorials there with easy directives. If you don’t understand something just go back some steps in the table of contents:

float[] x = new float[100];
float[] y = new float[100];
float[] speed = new float[100];

void setup() {
  size(500, 400);
  background(0);
  stroke(255);
  noCursor();

  int i = 0;
  while(i < 100) {  
    x[i] = random(0, width);
    y[i] = random(0, height);
    speed[i] = random(1, 5);
    i = i + 1;
  }
}

void draw() {
  background(0);

  // draw triangle
  triangle(mouseX, mouseY, mouseX+6, mouseY-30, mouseX+12, mouseY);
  
  int i = 0;
  while(i < 100) {
    float co = map(speed[i], 1, 5, 100, 255);
    stroke(co);
    strokeWeight(speed[i]);
    point(x[i], y[i]); 
    y[i] = y[i] + speed[i] / 2;
    if(y[i] > 400) {
      y[i] = 0;
    }
    i = i + 1;
  }
}

I was looking for something that uses an image rather than creating the stars in processing.

One possibility is:

// PImage img; Your actual background image
PGraphics img; // Just as an example
int y;

void setup() {
  size(500, 500);
  background(255);
  img = createGraphics(width, height);
  img.beginDraw();
  img.background(0, 0, 80);
  img.stroke(255);
  img.line(0, 0, width, height);
  img.line(width, 0, 0, height);
  for (int i = 0; i < height; i += 50) img.line(0, i, width, i);
  img.endDraw();
}

void draw() {
  image(img, 0, -height+y);
  image(img, 0, y++);
  if (y > height) y = 0;
}