From 1418bd1b44ec44ff0b2c2e795766898e529f4159 Mon Sep 17 00:00:00 2001 From: Gabriela Bestial <93128334+BeastlyGabi@users.noreply.github.com> Date: Sat, 1 Jul 2023 10:13:09 -0400 Subject: [PATCH 1/8] Update PlayState.hx --- source/funkin/game/PlayState.hx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index e0e518f3..3866f0ca 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1456,18 +1456,16 @@ class PlayState extends MusicBeatState scripts.event("onNoteHit", event); if (!event.cancelled) { + if (event.score) songScore += score; if (event.accuracy != null) { accuracyPressedNotes++; totalAccuracyAmount += event.accuracy; - updateRating(); } if (event.countAsCombo) combo++; if (event.showRating || (event.showRating == null && event.player && !note.isSustainNote)) { - songScore += score; - var separatedScore:String = Std.string(combo).addZeros(3); if (combo == 0 || combo >= 10) { @@ -1726,4 +1724,4 @@ typedef PlayStateTransitionData = { var camFollowX:Float; var camFollowY:Float; var camZoom:Float; -} \ No newline at end of file +} From 5bf537b48ec57e0dc52f2f2c960cfacb4163b830 Mon Sep 17 00:00:00 2001 From: Gabriela Bestial <93128334+BeastlyGabi@users.noreply.github.com> Date: Sat, 1 Jul 2023 10:15:22 -0400 Subject: [PATCH 2/8] Update PlayState.hx --- source/funkin/game/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 3866f0ca..29d2517b 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1456,7 +1456,7 @@ class PlayState extends MusicBeatState scripts.event("onNoteHit", event); if (!event.cancelled) { - if (event.score) songScore += score; + if (event.countScore) songScore += score; if (event.accuracy != null) { accuracyPressedNotes++; totalAccuracyAmount += event.accuracy; From 8ffc7c1691277767ee5c638b940471bf6e863153 Mon Sep 17 00:00:00 2001 From: Gabriela Bestial <93128334+BeastlyGabi@users.noreply.github.com> Date: Sat, 1 Jul 2023 10:16:45 -0400 Subject: [PATCH 3/8] Update NoteHitEvent.hx --- source/funkin/backend/scripting/events/NoteHitEvent.hx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/scripting/events/NoteHitEvent.hx b/source/funkin/backend/scripting/events/NoteHitEvent.hx index 4a42733f..e3c8bbc0 100644 --- a/source/funkin/backend/scripting/events/NoteHitEvent.hx +++ b/source/funkin/backend/scripting/events/NoteHitEvent.hx @@ -16,9 +16,13 @@ final class NoteHitEvent extends CancellableEvent { */ public var misses:Bool = true; /** - * Whenever a miss should be added. + * Whether this hit increases combo. */ public var countAsCombo:Bool = true; + /** + * Whether this hit increases the score + */ + public var countScore:Bool = true; /** * Whenever ratings should be shown or not. */ @@ -170,4 +174,4 @@ final class NoteHitEvent extends CancellableEvent { characters = [char]; return char; } -} \ No newline at end of file +} From 1809ba790dbeb522a55abc532f2bfb2b6ace7021 Mon Sep 17 00:00:00 2001 From: Gabriela Bestial <93128334+BeastlyGabi@users.noreply.github.com> Date: Sat, 1 Jul 2023 11:08:23 -0400 Subject: [PATCH 4/8] Update PlayState.hx --- source/funkin/game/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 29d2517b..b33d123b 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1456,7 +1456,7 @@ class PlayState extends MusicBeatState scripts.event("onNoteHit", event); if (!event.cancelled) { - if (event.countScore) songScore += score; + if (event.countScore) songScore += event.score; if (event.accuracy != null) { accuracyPressedNotes++; totalAccuracyAmount += event.accuracy; From b6361a0a5ff5605515159e79a564f17ff1571e05 Mon Sep 17 00:00:00 2001 From: Gabriela Bestial <93128334+BeastlyGabi@users.noreply.github.com> Date: Sat, 1 Jul 2023 11:17:43 -0400 Subject: [PATCH 5/8] Update PlayState.hx --- source/funkin/game/PlayState.hx | 130 +++++++++++++++++--------------- 1 file changed, 68 insertions(+), 62 deletions(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index b33d123b..9577a2be 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1466,68 +1466,8 @@ class PlayState extends MusicBeatState if (event.showRating || (event.showRating == null && event.player && !note.isSustainNote)) { - var separatedScore:String = Std.string(combo).addZeros(3); - - if (combo == 0 || combo >= 10) { - if (combo >= 10) { - var comboSpr:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${event.ratingPrefix}combo${event.ratingSuffix}')); - comboSpr.resetSprite(comboGroup.x, comboGroup.y); - comboSpr.acceleration.y = 600; - comboSpr.velocity.y -= 150; - comboSpr.velocity.x += FlxG.random.int(1, 10); - - comboSpr.scale.set(event.ratingScale, event.ratingScale); - comboSpr.antialiasing = event.ratingAntialiasing; - - comboSpr.updateHitbox(); - - FlxTween.tween(comboSpr, {alpha: 0}, 0.2, { - onComplete: function(tween:FlxTween) - { - comboSpr.visible = comboSpr.active = false; - }, - startDelay: Conductor.crochet * 0.001 - }); - } - for (i in 0...separatedScore.length) - { - var numScore:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${event.ratingPrefix}num${separatedScore.charAt(i)}${event.ratingSuffix}')); - numScore.resetSprite(comboGroup.x + (43 * i) - 90, comboGroup.y + 80); - numScore.antialiasing = event.numAntialiasing; - numScore.scale.set(event.numScale, event.numScale); - numScore.updateHitbox(); - - numScore.acceleration.y = FlxG.random.int(200, 300); - numScore.velocity.y -= FlxG.random.int(140, 160); - numScore.velocity.x = FlxG.random.float(-5, 5); - - FlxTween.tween(numScore, {alpha: 0}, 0.2, { - onComplete: function(tween:FlxTween) - { - numScore.visible = numScore.active = false; - }, - startDelay: Conductor.crochet * 0.002 - }); - } - } - - var rating:FlxSprite = comboGroup.recycleLoop(FlxSprite); - rating.resetSprite(comboGroup.x + -40, comboGroup.y + -60); - rating.loadAnimatedGraphic(Paths.image('${event.ratingPrefix}$daRating${event.ratingSuffix}')); - rating.acceleration.y = 550; - rating.velocity.y -= FlxG.random.int(140, 175); - rating.velocity.x -= FlxG.random.int(0, 10); - rating.scale.set(event.ratingScale, event.ratingScale); - rating.antialiasing = event.ratingAntialiasing; - rating.updateHitbox(); - - FlxTween.tween(rating, {alpha: 0}, 0.2, { - startDelay: Conductor.crochet * 0.001, - onComplete: function(tween:FlxTween) { - rating.visible = rating.active = false; - } - }); - + displayCombo(event); + displayJudgement(daRating, event); ratingNum += 1; } @@ -1556,6 +1496,72 @@ class PlayState extends MusicBeatState if (event.deleteNote && !note.isSustainNote) strumLine.deleteNote(note); } + public function displayJudgement(myRating:String, evt:NoteHitEvent):Void { + var rating:FlxSprite = comboGroup.recycleLoop(FlxSprite); + rating.resetSprite(comboGroup.x + -40, comboGroup.y + -60); + rating.loadAnimatedGraphic(Paths.image('${evt.ratingPrefix}${myRating}${evt.ratingSuffix}')); + rating.acceleration.y = 550; + rating.velocity.y -= FlxG.random.int(140, 175); + rating.velocity.x -= FlxG.random.int(0, 10); + rating.scale.set(event.ratingScale, event.ratingScale); + rating.antialiasing = event.ratingAntialiasing; + rating.updateHitbox(); + + FlxTween.tween(rating, {alpha: 0}, 0.2, { + startDelay: Conductor.crochet * 0.001, + onComplete: function(tween:FlxTween) { + rating.visible = rating.active = false; + } + }); + } + + public function displayCombo(evt:NoteHitEvent):Void { + var separatedScore:String = Std.string(combo).addZeros(3); + + if (combo == 0 || combo >= 10) { + if (combo >= 10) { + var comboSpr:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${event.ratingPrefix}combo${event.ratingSuffix}')); + comboSpr.resetSprite(comboGroup.x, comboGroup.y); + comboSpr.acceleration.y = 600; + comboSpr.velocity.y -= 150; + comboSpr.velocity.x += FlxG.random.int(1, 10); + + comboSpr.scale.set(event.ratingScale, event.ratingScale); + comboSpr.antialiasing = event.ratingAntialiasing; + comboSpr.updateHitbox(); + + FlxTween.tween(comboSpr, {alpha: 0}, 0.2, { + onComplete: function(tween:FlxTween) + { + comboSpr.visible = comboSpr.active = false; + }, + startDelay: Conductor.crochet * 0.001 + }); + } + + for (i in 0...separatedScore.length) + { + var numScore:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${evt.ratingPrefix}num${separatedScore.charAt(i)}${evt.ratingSuffix}')); + numScore.resetSprite(comboGroup.x + (43 * i) - 90, comboGroup.y + 80); + numScore.antialiasing = event.numAntialiasing; + numScore.scale.set(event.numScale, event.numScale); + numScore.updateHitbox(); + + numScore.acceleration.y = FlxG.random.int(200, 300); + numScore.velocity.y -= FlxG.random.int(140, 160); + numScore.velocity.x = FlxG.random.float(-5, 5); + + FlxTween.tween(numScore, {alpha: 0}, 0.2, { + onComplete: function(tween:FlxTween) + { + numScore.visible = numScore.active = false; + }, + startDelay: Conductor.crochet * 0.002 + }); + } + } + } + public inline function deleteNote(note:Note) if (note.strumLine != null) note.strumLine.deleteNote(note); From c7de8ceaaab0e863f12c809c1b19649571928cab Mon Sep 17 00:00:00 2001 From: Gabriela Bestial <93128334+BeastlyGabi@users.noreply.github.com> Date: Sat, 1 Jul 2023 11:18:53 -0400 Subject: [PATCH 6/8] my bad --- source/funkin/game/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 9577a2be..c49b6b49 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1520,7 +1520,7 @@ class PlayState extends MusicBeatState if (combo == 0 || combo >= 10) { if (combo >= 10) { - var comboSpr:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${event.ratingPrefix}combo${event.ratingSuffix}')); + var comboSpr:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${evt.ratingPrefix}combo${evt.ratingSuffix}')); comboSpr.resetSprite(comboGroup.x, comboGroup.y); comboSpr.acceleration.y = 600; comboSpr.velocity.y -= 150; From a7024a5ea11d91cdd6a5db3d0930ae2300e941a1 Mon Sep 17 00:00:00 2001 From: Gabriela Bestial <93128334+BeastlyGabi@users.noreply.github.com> Date: Sat, 1 Jul 2023 11:23:37 -0400 Subject: [PATCH 7/8] Update PlayState.hx --- source/funkin/game/PlayState.hx | 34 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index c49b6b49..71994c15 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1456,19 +1456,21 @@ class PlayState extends MusicBeatState scripts.event("onNoteHit", event); if (!event.cancelled) { - if (event.countScore) songScore += event.score; - if (event.accuracy != null) { - accuracyPressedNotes++; - totalAccuracyAmount += event.accuracy; - updateRating(); - } - if (event.countAsCombo) combo++; - - if (event.showRating || (event.showRating == null && event.player && !note.isSustainNote)) - { - displayCombo(event); - displayJudgement(daRating, event); - ratingNum += 1; + if (!note.isSustainNote) { + if (event.countScore) songScore += event.score; + if (event.accuracy != null) { + accuracyPressedNotes++; + totalAccuracyAmount += event.accuracy; + updateRating(); + } + if (event.countAsCombo) combo++; + + if (event.showRating || (event.showRating == null && event.player)) + { + displayCombo(event); + displayJudgement(daRating, event); + ratingNum += 1; + } } if (strumLine != null) strumLine.addHealth(event.healthGain); @@ -1510,7 +1512,7 @@ class PlayState extends MusicBeatState FlxTween.tween(rating, {alpha: 0}, 0.2, { startDelay: Conductor.crochet * 0.001, onComplete: function(tween:FlxTween) { - rating.visible = rating.active = false; + rating.kill(); } }); } @@ -1533,7 +1535,7 @@ class PlayState extends MusicBeatState FlxTween.tween(comboSpr, {alpha: 0}, 0.2, { onComplete: function(tween:FlxTween) { - comboSpr.visible = comboSpr.active = false; + comboSpr.kill(); }, startDelay: Conductor.crochet * 0.001 }); @@ -1554,7 +1556,7 @@ class PlayState extends MusicBeatState FlxTween.tween(numScore, {alpha: 0}, 0.2, { onComplete: function(tween:FlxTween) { - numScore.visible = numScore.active = false; + numScore.kill(); }, startDelay: Conductor.crochet * 0.002 }); From a3193f29edeb115c4148065e532eda5b5f153034 Mon Sep 17 00:00:00 2001 From: Gabriela Bestial <93128334+BeastlyGabi@users.noreply.github.com> Date: Sat, 1 Jul 2023 13:30:53 -0400 Subject: [PATCH 8/8] make events for sprite functions optional so you can just do `displayRating("CUSTOM-RATING");` without requiring one --- source/funkin/game/PlayState.hx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 71994c15..29c3328a 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1468,7 +1468,7 @@ class PlayState extends MusicBeatState if (event.showRating || (event.showRating == null && event.player)) { displayCombo(event); - displayJudgement(daRating, event); + displayRating(daRating, event); ratingNum += 1; } } @@ -1498,10 +1498,13 @@ class PlayState extends MusicBeatState if (event.deleteNote && !note.isSustainNote) strumLine.deleteNote(note); } - public function displayJudgement(myRating:String, evt:NoteHitEvent):Void { + public function displayRating(myRating:String, ?evt:NoteHitEvent = null):Void { + var pre:String = evt != null ? evt.ratingPrefix : ""; + var suf:String = evt != null ? evt.ratingSuffix : ""; + var rating:FlxSprite = comboGroup.recycleLoop(FlxSprite); rating.resetSprite(comboGroup.x + -40, comboGroup.y + -60); - rating.loadAnimatedGraphic(Paths.image('${evt.ratingPrefix}${myRating}${evt.ratingSuffix}')); + rating.loadAnimatedGraphic(Paths.image('${pre}${myRating}${suf}')); rating.acceleration.y = 550; rating.velocity.y -= FlxG.random.int(140, 175); rating.velocity.x -= FlxG.random.int(0, 10); @@ -1517,12 +1520,15 @@ class PlayState extends MusicBeatState }); } - public function displayCombo(evt:NoteHitEvent):Void { + public function displayCombo(?evt:NoteHitEvent = null):Void { + var pre:String = evt != null ? evt.ratingPrefix : ""; + var suf:String = evt != null ? evt.ratingSuffix : ""; + var separatedScore:String = Std.string(combo).addZeros(3); if (combo == 0 || combo >= 10) { if (combo >= 10) { - var comboSpr:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${evt.ratingPrefix}combo${evt.ratingSuffix}')); + var comboSpr:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${pre}combo${suf}')); comboSpr.resetSprite(comboGroup.x, comboGroup.y); comboSpr.acceleration.y = 600; comboSpr.velocity.y -= 150; @@ -1543,7 +1549,7 @@ class PlayState extends MusicBeatState for (i in 0...separatedScore.length) { - var numScore:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${evt.ratingPrefix}num${separatedScore.charAt(i)}${evt.ratingSuffix}')); + var numScore:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${pre}num${separatedScore.charAt(i)}${suf}')); numScore.resetSprite(comboGroup.x + (43 * i) - 90, comboGroup.y + 80); numScore.antialiasing = event.numAntialiasing; numScore.scale.set(event.numScale, event.numScale);