I generate a blocklist within the constructor of my world and then call it from my actor after but I keep on getting Null Pointer Exceptions on that line and I'm not too sure what's up.
this is the code in my world class to make the blocklist
here I have an act method within my world which I call my actor from.
this is where i call the list from my actor class and is where my error is occurring.
//Create block objects and assign them to a list
blockList = new ArrayList();
for (int i = 0; i < numNewBlocks; i++) {
blockList.add(newBlock(sizeBlock,getWidth(),Greenfoot.getRandomNumber(maxOfRange),maxOfRange,debug));
addObject( (Actor)blockList.get( blockList.size()-1 ), getWidth()/2, (i*sizeBlock)+(sizeBlock/2) );
}public void act() {
//Step by Step Bubble Sort
CocktailShakerVisualizerOkabe sort = new CocktailShakerVisualizerOkabe();
//addObject(sort,10,10);
sort.move();
}{
if (size <= 0){
blockList = ((SortingVisualization)getWorld()).getBlockList(); // getting null value???
size = blockList.size();
System.out.println(blockList.size());
}
