-1
我正在開發一個JavaME遊戲,我需要計算我的遊戲中碰撞的次數。 我使用collidesWith()
方法,和我做這樣的事情:如何計算JavaME中collidesWith()的衝突次數?
private void checkCollision()
{
if (spBoy.collidesWith(spBall, true)) {
this.collides++;
if (this.collides == 3) {
//here I will show a Game Over image.
}
}
}
正如你所看到的,如果衝突的數量爲3,遊戲就結束了,但我不能算碰撞次數,因爲當我增加this.collides
時,我自動在一次中有3次碰撞。