I imported the counter class and i been fooling around with it but getting no where ,its a simple shoot the balloon game with about 3 levels,which is a subclass of the main world (helperclass)
if theres another easy way to get the counter running do tell :) and thanks in advance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | public class helperClass extends World { Counter counter = new Counter(); /** * Constructor for objects of class helperClass. * */ public helperClass() { super ( 600 , 400 , 1 , false ); GreenfootImage bg = getBackground(); bg.setColor(Color.GREEN); bg.fill(); prepare(); } public Counter getCount() { return counter; } } |
1 2 3 4 5 6 7 8 9 10 11 | public void eat() { //in my actor class eat(balloon. class ); helperClass Hclass = (helperClass)getWorld(); Counter counter = Hclass.getCount(); counter.getCount(); counter.getValue(); } |