Used code as above, but when I ran the game it came up with a null pointer exception on the code below
Here is the code from the Counter 3 class
world worldWorld = (world) getWorld(); Counter3 counter3 = worldWorld.getCounter3(); int choice = counter3.getCount3);
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Color; /** * Write a description of class Counter here. * * @author (your name) * @version (a version number or a date) */ public class Counter3 extends Actor { private int totalCount = 1; public Counter3() { setImage(new GreenfootImage("", 1, Color.WHITE, Color.WHITE)); } public int getCount() { return totalCount; } /** * Increase the total amount displayed on the counter, by a given amount. */ public void bumpCount(int amount) { totalCount += amount; setImage(new GreenfootImage("" + totalCount, 20, Color.WHITE, Color.BLACK)); } public void setCount(int amount) { totalCount = amount; setImage(new GreenfootImage("" + totalCount, 20, Color.WHITE, Color.BLACK)); } }