I was wondering if there is a way you could increase your score counter by more than one? For example, when a snake eats a cherry, I want it to increase by one, but when it eats a blueberry, I want it to increase by 5.
This is my code:
public class Score extends Actor
{
private int score = 0;
public Score(){
updateImage();
}
/**
* Act - do whatever the Score wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void updateImage()
{
setImage(new GreenfootImage("Score : "+ score,20,greenfoot.Color.BLACK, greenfoot.Color.WHITE));
}
public void addScoreCherries(){
score++;
updateImage();
}
}
