java - Libgdx: Scoring points basic -
i trying code score system increments whenever collision occurs between enemy , player. initialize score 100 , incremented once collision detected, means the old score 100 , new 1 101. happen old score 0 while new score 100. can me debut code. thank you. here code: code in bpaste when call getscore() first time, hasn't been initialized yet, returns 0. what scoreincrement() method add 100 tempscore, added score (which 100). if understood intentions correctly, use this: //initialize score 100 private int score = 100; //method incrementing score 1 public void scoreincrement() { score++; } //score getter public int getscore() { return score; }