From the information I have gathered from your 'Questions I suspect you might have' section, I would think that this works in a way similar to my 'PIP Actor class' scenario. Am I correct?
The last statement should include the code where you are trying to pass the score to the Gameover world. When supplying code, also include what class the code is in and how it relates to the World or Actor class.
The code for the Counter class is the code for the Counter class regardless of the active World. You cannot 'pass' code. All code belongs to the class that it is found in, and to no other. The only things you can pass are values and objects (what is actually passed, where 'objects' are concerned, is the address in memory where the data for the object (an instance created from a class) is located.
The code for the Counter class is not what you need to deal with for you issue. It is the code that defines, creates, and works with the object created from the class that is important, here.
I forgot to add the location coordinates to draw the image in the 'drawImage' line; also, the colors ('null' values in the example) can be replaced with actual colors. The example was just one possible way of adding the final score into the Gameover world.
You can pass it using 'new Gameover(int)' (you will need to adjust your constructor declaration statement to accept the int value) or you can 'pass' it after creating the Gameover world:
[code]Gameover go = new Gameover();
go.getBackground().drawImage(new GreenfootImage("Final score: "+score, 36, null, null));
Greenfoot.setWorld(go);[/code]
2014/11/1
Blackjack
2014/10/29
ScrollingWorld showcase
2014/10/26
Storage test
2014/10/24
Belt of Danger
2014/10/24
Belt of Danger
2014/10/24
Belt of Danger
2014/10/11
Asteroids w/improved QActor SuperClass
2014/10/10
Belt of Danger
2014/10/10
Belt of Danger