I've been stuck on this problem for a few days now. I have a few forloops adding rows of trees, and when stairs are hit, the trees need to be removed. I finally got the code to work without throwing an error, but I encountered a new problem.
Successfully gets removed:
Doesn't:
addObject(new Tree(areaCount), 200, 300);
This is a problem because the trees are added in in bulk, and with specific numbers, so I create many instances of them. I can't just have one tree. Any ideas on how to remove the trees with a specific number? It throws a Null Pointer with the second code pretty much saying it can't be removed because "Tree" isn't in the world (which it is), but works with the first because it "is" in the world.
addObject(Tree, 200, 300);