is it possible to have an identical counter in different actor classes, but when i add +1 to it, it adds to an overall counter/adds all the the times I add 1 to the counter from the seperate classes?
Counter counter = null;
counter = new Counter(); addObject(counter, xLocation, yLocation);
Counter counter = null;
protected void addedToWorld(World world) { counter = world.counter; }
counter.value += 1;
public class Counter { private static int counter = 0; public static int getCounter() { return counter; } public static void setCounter(int value) { counter = value } public static void incremementCounter() { counter++; } }
Counter.getCounter();