Here's my code:
I always get the error "cannot find symbol — method living()"
What is going on?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
[code]import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Cell here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Cell extends Actor
{
public boolean alive = false;
/**
* Act - do whatever the Cell wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
}
public boolean living()
{
return alive;
}
public int neighbours()
{
int i = 0;
Actor j = getOneObjectAtOffset(32,32,Cell.class);
if(j != null) {
if(j.living())
{
i++;
}}
j = getOneObjectAtOffset(32,32,Cell.class);
if(j != null){
if(j.living())
{
i++;
}}
j = getOneObjectAtOffset(32,32,Cell.class);
if(j != null) {
if(j.living())
{
i++;
}}
j = getOneObjectAtOffset(32,32,Cell.class);
if(j != null){
if(j.living())
{
i++;
}}
return i;
}
}

