Skip to content

Commit

Permalink
Do not repeatedly detach and attach bonusScore for every full spinn…
Browse files Browse the repository at this point in the history
…er rotation

Just attaching once is enough.
  • Loading branch information
Rian8337 committed Feb 11, 2025
1 parent dd5ab9a commit b1a3e0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/ru/nsu/ccfit/zuev/osu/game/GameplayModernSpinner.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,13 @@ public void update(float dt) {
// Clear Sprite
clear = true;
} else if (Math.abs(rotations) > 1) {
if (bonusScore.hasParent()) {
scene.detachChild(bonusScore);
}
rotations -= 1 * Math.signum(rotations);
bonusScore.setText(String.valueOf(bonusScoreCounter * 1000));
listener.onSpinnerHit(id, 1000, false, 0);
bonusScoreCounter++;
scene.attachChild(bonusScore);
if (!bonusScore.hasParent()) {
scene.attachChild(bonusScore);
}
spinnerBonusSample.play();
glow.registerEntityModifier(
Modifiers.sequence(
Expand Down
7 changes: 3 additions & 4 deletions src/ru/nsu/ccfit/zuev/osu/game/GameplaySpinner.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,13 @@ public void update(final float dt) {
scene.attachChild(clearText);
clear = true;
} else if (Math.abs(rotations) > 1) {
if (bonusScore.hasParent()) {
scene.detachChild(bonusScore);
}
rotations -= 1 * Math.signum(rotations);
bonusScore.setText(String.valueOf(bonusScoreCounter * 1000));
listener.onSpinnerHit(id, 1000, false, 0);
bonusScoreCounter++;
scene.attachChild(bonusScore);
if (!bonusScore.hasParent()) {
scene.attachChild(bonusScore);
}
spinnerBonusSample.play();
float rate = 0.375f;
if (GameHelper.getHealthDrain() > 0) {
Expand Down

0 comments on commit b1a3e0f

Please sign in to comment.