The Program shows that everything is fine and without a syntax error. But as soon as a point should go up caused by a collision a white screen comes up with a mistake notice.
The Code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class counter here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Counter extends Actor
{
public int score;
public Counter()
{
setImage(new GreenfootImage("0", 20, Color.WHITE, Color.BLACK));
}
public void act()
{
if(score>=10){
setLocation(400,250);
setImage(new GreenfootImage("The player2 won!",60,Color.RED,Color.BLACK));
Greenfoot.stop();
}
}
public void scoreCount(int amount){
score += amount;
setImage(new GreenfootImage("" + score));
}
}
