Hey. I wrote the code seen below:
And the methods I use to create a class that did not see the new value. Why is this?
import greenfoot.*; import java.awt.Color; public class Score extends Actor { public int score; public Score() { setImage(new GreenfootImage("Score: "+score,18,Color.BLACK,Color.GREEN)); } public void addScore(int pn) { pn = pn; score = score + pn; } public int getScore() { return score; } public void update() { setImage(new GreenfootImage("Score: "+score,18,Color.BLACK,Color.GREEN)); } }