i made a class/actor that i want to show my score in the world.
but how can i make this text show up in my world, as well to add "score" which represent when something is eaten(code i am posting, has an error for addObject)(this code is in my world)(the text commented out is what i had previously, but i can change color in that part)
1 2 3 4 5 6 7 | public class ScoreCounter extends Actor { public ScoreCounter() { setImage( new GreenfootImage( "Score: " , 283 , Color.WHITE, new Color( 0 , 0 , 0 , 0 ))); } } |
1 2 3 4 5 6 7 8 9 | /** * Show our current score on screen. */ private void showScore() { //showText("Score: " + score, 600, 20); ScoreCounter scorecounter = new ScoreCounter(); addObject(scorecounter, + score, 600 , 20 ); } |