Hey I have a problem, I set a Score counter in my world, and it works well (inspired from the counter of the tutorial, with the rocket),
the problem is when I try to add it in the next level, the value goes back to 0.
Here is how I did, I set a subclass for all the levels (2 at the moment), with the method for the variable in it.
Then I simply add the new Score (Score.class)
I found the second try here : http://www.greenfoot.org/topics/1057
It was like that : Timer timer = (Timer) getWorld().getObjects(Timer.class).get(0);
I tried to set it so it works in my worlds, but the get(0) is a problem. whatever is the value, I get an rror message.
Thanks a lot !
public Score getScore()
{
return theScore;
}//In first world, where everything goes well
theScore = new Score();
addObject(theScore, 100, 640);
//The method to do the score, what you'll find in an actor Class to score
public void doTheScore( int amountOfScore)
{
WMethod wmethod = (WMethod) getWorld();
Score score = wmethod.getScore();
score.getTheScore(amountOfScore);
}//WMethod is the world subclass
//How I try to add it in second level (name Espace3)
//First I try the same way as before, but it doesnt work
//theScore = new Score();
//Then I try this, i found it on a topic, but doesnt work. give me an error message
Score score = (Score)getObjects(Score.class);
addObject(score, 100, 640);



