Hi. Doing one of those "game of life" thingies. Long story short, I have a grid of about 2500 squares. Each square is an object in an array. Each square is randomly assigned a true or false boolean status (to signify alive and dead).
What I need is just to understand how to return the boolean status of one of these square objects at a specific location.
The line labelled with "******" returns a java.lang.NullPointerException error. So I call a method to check the boolean status of an object, but apparently it doesn't quiet work. I'll post more code if needed.
I'm still pretty new to this, so it's pretty hard for me to see what wrong.
While I'm here, can someone please explain why " Cell temp = (Cell) getOneObjectAtOffset(-1,0,Cell.class);" always needs the "(Cell)" part. I haven't a clue what the means or why I need it for some methods in greenfoot.
Anyway, the problematic code:
public boolean getStatus(){
return alive;
}
private void countCells()
{
Cell temp = (Cell) getOneObjectAtOffset(-1,0,Cell.class);
****** if(temp.getStatus() == true) *********
{
setStatus(false);
System.out.println("cats");
}
Thanks in advance

