Error in Processing program

You never set Globalcards[0] to be anything!

You have this loop in setup():

  for(int i = 1; i<12; i++){
    Globalcards[i] = new Cards (x[i], y[i], f[i]);
  }

When you actually need this loop:

  for(int i = 0; i<12; i++){
    Globalcards[i] = new Cards (x[i], y[i], f[i]);
  }

Notice that the 1 becomes a 0. This minor change ensures that, in this loop, Globalcards[0] is also assigned to be something.

1 Like