what i was supposed to do if want score that show at the end for final score
i have level 1 and level 2 that the score is continue but i don not know to put at the end..
level 1
level2
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Background1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Background1 extends World
{
/**
* Constructor for objects of class Background1.
*
*/
public Background1()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(800, 600, 1);
prepare();
}
private void prepare()
{
Rahmat rahmat = new Rahmat();
addObject(rahmat,42,260);
rahmat.setLocation(35,270);
score = new Score();
addObject(score, 740, 40);
addObject(new Pisang(),100,270);
addObject(new Pisang(),140,270);
addObject(new Pisang(),180,270);
addObject(new tree(),22,80);
addObject(new tree(),22,108);
addObject(new tree(),22,136);
addObject(new tree(),22,164);
addObject(new Monyet(),83,220);
addObject(new Monyet1(),486,160);
addObject(new Monyet2(),630,115);
addObject(new Monyet3(),355,320);
addObject(new Monyet4(),440,490);
addObject(new Monyet5(),280,560);
addObject(new key(),650,345);
addObject(new door(),130,480);
addObject(new Pause(),680,40);
life = new Life();
addObject(life, 50, 40);
}
public void nextLevel()
{
Greenfoot.setWorld(new level2());
}
static Score score;
public static Score getScore()
{
return score;
}
static Life life;
public static Life getLife()
{
return life;
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class level2 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class level2 extends World
{
/**
* Constructor for objects of class level2.
*
*/
public level2()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(800, 600, 1);
Rahmat rahmat = new Rahmat();
addObject(rahmat,42,260);
rahmat.setLocation(35,330);
addObject(new tree(),25,80);
addObject(new tree(),25,108);
addObject(new M23(),310,567);
addObject(new M24(),210,275);
addObject(new M25(),70,180);
addObject(new M26(),355,180);
addObject(new M27(),445,180);
addObject(new M28(),560,275);
addObject(new M29(),475,415);
addObject(new Mawar(),715,380);
addObject(new M30(),630,520);
addObject(new Ular(),217,65);
addObject(new Pause(),670,37);
addObject(new Pisang(),60,517);
addObject(score, 740, 40);
addObject(life, 50, 40);
}
Score score = Background1.getScore();
public Score getScore()
{
return score;
}
Life life = Background1.getLife();
public Life getLife()
{
return life;
}
}
