Hey guys i'm new to Greenfoot and i'm recreating flappy bird for a project. I everything was fine with my code until I attempted to add a score counter into my code. Now whenever I try to run my world, it will not create it and give me the error message : java.lang.NullPointerException
I should point out that the error highlighted the "public class Score extends Actor" portion of this code. I'd really appreciate the help.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
[b]public class Score extends Actor
[/b]{
public Score() {
GreenfootImage newImage = new GreenfootImage(50, 50);
setImage(newImage);
}
public void setScore(int score) {
GreenfootImage newImage = getImage();
newImage.clear();
newImage.drawString("" + score, 24, 27);
setImage(newImage);
}
}
