Hi, I need code, when actor reach score 10, he can go to the next level.
Here is my code in actor Counter, where I have score counter.
And here is code in player actor.
public int score;
/**
* Act - do whatever the Counter wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
}
public Counter()
{
updateImage();
}
private void updateImage()
{
setImage(new GreenfootImage("SEBRANÝCH KYTEK: 10/" +score, 24, Color.BLACK, Color.WHITE));
}
public void addScore()
{
score++;
updateImage();
}public void stretSKytkou()
{
if(isTouching(Kytka.class))
{
World myWorld = getWorld();
Louka louka = (Louka)myWorld;
Counter counter = louka.getCounter();
counter.addScore();
this.getWorld().removeObject(this.getOneIntersectingObject(Kytka.class));
}
}

