嗨,我正在尝试在公共 void minScore 中将计数器减少为 1
score++ 将计数器加 1 什么等同于将计数器减 1 ?
public class Counter extends Actor
{
private int score = 0;
public void act()
{
setImage(new GreenfootImage("Score : 0" + score, 24, Color.WHITE, Color.BLUE));
}
/**
* Increase the total amount displayed on the counter, by a given amount.
*/
public void addScore()
{
score++;
}
public void minScore()
{
score++;
}
}