Im having a really bad time trying to get a points system to stick. Chloe is my main character and everytime she touches a Mushroom I want her to earn a point, here's that bit of code:
That code links to this segment:
Then there's a bit later where the getScore is called in the world. However, when I actually go to interact with a Mushroom the score remains stuck at 1? There's no other code in the Chloe class that interacts with Points and Points only establishes the Private variable of score. Thanks.
1 2 3 4 5 6 7 8 9 10 11 | public void checkCollision() { if (isTouching(Mushroom. class )) { removeTouching(Mushroom. class ); Points p = new Points(); p.addScore( 1 ); } } |
1 2 3 4 5 6 7 8 9 10 | public void addScore( int point) { score = score + point; System.out.println(score); } public int getScore() { return score; } |