how can I create a reference to the counter from my actor class? here is my code in the actor class. Whenever I try to run it Greenfoot keeps telling me that a non-static method "getCounter1" cannot be refernced from static context.
public void eat()
1 2 3 4 5 6 7 8 9 10 11 | { if (isTouching(Food. class )){ removeTouching(Food. class ); foodEaten++; speed++; Counter1 counter1 = SnakeWorld.getCounter1(); counter1.addScore(); SnakeWorld world=(SnakeWorld)getWorld(); world.addFood(); } } |