Hi, i am trying to do a multiple level game,but the score keeps going back to 0 when i enter the next level. Here is my code in player class:
and here is what i did in the scoreboard class:
Can someone help me? please
private int score=0;
public void addScore()
{
if (!getWorld().getObjects(Scoreboard.class).isEmpty())
{
((Scoreboard) getWorld().getObjects(Scoreboard.class).get(0)).changeScore();
}
}private int score=0;
public void changeScore()
{
score=score+100;
GreenfootImage image=getImage();
image.clear();
image.drawString("Score:" + score,5,25);
}
