Skip to content

Commit

Permalink
this should do it
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Oct 19, 2024
1 parent dd1cbf4 commit 6b3a93f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ class PlayState extends ExtendableState {
score -= 10;
combo = 0;
misses++;
totalPlayed++;
updateAccuracy();
}
}
Expand Down Expand Up @@ -511,7 +512,6 @@ class PlayState extends ExtendableState {
case "no":
score += ratingScores[3];
isPerfect = false;
totalNotesHit++;
nos++;
}

Expand Down Expand Up @@ -569,11 +569,13 @@ class PlayState extends ExtendableState {
});
}

totalPlayed++;
updateAccuracy();

note.active = false;
notes.remove(note);
note.kill();
note.destroy();
updateAccuracy();
}
}

Expand All @@ -586,16 +588,15 @@ class PlayState extends ExtendableState {
notes.remove(note);
note.kill();
note.destroy();
updateAccuracy();
}
}
}
}
}

function updateAccuracy() {
totalPlayed++;
accuracy = Math.max(0, totalNotesHit / totalPlayed * 100);
// prevent divide by 0
accuracy = (totalPlayed > 0) ? (totalNotesHit / totalPlayed) * 100 : 0;
}

function generateRank():String {
Expand Down

0 comments on commit 6b3a93f

Please sign in to comment.