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]
Added some needed methods to the QActor class. One for moving a given distance in the direction facing, another for moving a given distance in a given direction, and one to set a fine-tuned rotation. Also made the overridden 'setLocation' method 'public' for setting a fine-tuned location.
@Green_Code, actually, no. All the energy would be transferred to the forward marble and the one doing the hitting would presumably stop. In real life, the only difference would be due to the roll of the first marble. Compare them to, lets say, billiard balls. The one doing the hitting would roll slightly forward. The only ways the hitting marble would reverse is if it had back-spin on it during contact OR if the second marble had more mass than the first (provided no other objects are influencing the system).
The storage is for scenario info for each user. Your program decides what data can be saved for each user. Refer to the UserInfo class API documentation for more info (Documentation link above followed by 'online' API documentation -- select UserInfo class).
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
2014/10/8
Asteroids w/improved QActor SuperClass
2014/10/8
Asteroids w/improved QActor SuperClass
2014/10/7
Asteroids w/improved QActor SuperClass
2014/10/7
Marbles
2014/9/13
Zombie Shooter Demo