I have been able to successfully get the score to pop up at the Goldfish's location but it then stays there and another "Score: " with whatever number representing the change in score pops up at the next location where the Goldfish eats another Puffer for a point. How can I make the score be displayed only where the Goldfish is?
/**
* Method to make Goldfish eat touching puffer and score a point
*/
public void eatPuffer()
{
if(isTouching(Puffer.class) == true)
{
removeTouching(Puffer.class);
Greenfoot.playSound("crunch.wav");
score = score + 1;
getWorld().showText("Score: " + score, getX(), getY());
}
if(score==50)
{
GreenfootSound sound1 = new GreenfootSound("victory.mp3");
sound1.play();
getWorld().addObject(new Victory(), 390, 180);
while(sound1.isPlaying()) {} // wait til sound1 finishes playing
Greenfoot.playSound("you win.mp3");
Greenfoot.stop();
}
}
