What you can do, since the Counter object holds the scores to begin with, is add another field to it to hold the highest score (so far).
Then, any place the 'value' field is changed, call 'setHighest'. That means in 'add', in 'subtract', in 'setValue', wherever.
When a new world is created, you can either pass the counter object to it or set the 'new' counter object with the highest by doing this:
// declare it as follows private int highest; // add these helper methods private void setHighest() { // 'value' may not be the right name for the variable if (value > highest) highest = value; } public int getHighest() { return highest; }
PlayWorld pw = new PlayWorld(); ((Counter) newCounter = (Counter)pw.getObjects(Counter.class).get(0); newCounter.setValue(counter.getHighest()); newCounter.setHighest(); newCounter.setValue(0);