1
嗨,我試圖降低與1計數器在公共無效MinScore是的Greenfoot計數器減一
得分++增加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++;
}
}
簡單地說'得分 - ;' – Tunaki
我也想到了它,但是這給出了語法錯誤。它 - 得分; –
@RemiMinnebo,爲什麼?顯示你的堆棧跟蹤 – Andrew