We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Whenever I try to run this I get the addObstacle function I get a NullPointerException error. Please help.
ArrayList<Level> levels;
class Level{
  ArrayList<Obstacle> obstacles;
  Level(){
  }
  void load(){
  }
  void addObstacle (float x1 , float y1 , float x2 , float y2 , int t){
    obstacles.add (new Obstacle (x1 , y1, x2 , y2, t));
  }
}
Comments
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
Can you put up the Obstacle class? We don't really know what you're doing in there.
i don't think we need that tbh.
line 5 is not enough to create an ArrayList. you need to assign the result of
new ArrayList();to it somewhere (maybe even line 5 itself)