From 45652399c35fe13e1b0eb9110c8c11bc01754e86 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 26 Mar 2021 03:51:39 -0400 Subject: [PATCH] cool note thingies --- source/NoteSplash.hx | 38 ++++++++++++++++++++++++++++++++++++++ source/PlayState.hx | 17 +++++++++++++++-- source/ui/SettingsMenu.hx | 9 +++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 source/NoteSplash.hx create mode 100644 source/ui/SettingsMenu.hx diff --git a/source/NoteSplash.hx b/source/NoteSplash.hx new file mode 100644 index 000000000..a06bd024c --- /dev/null +++ b/source/NoteSplash.hx @@ -0,0 +1,38 @@ +package; + +import flixel.FlxG; +import flixel.FlxSprite; +import haxe.io.Path; + +class NoteSplash extends FlxSprite +{ + public function new(x:Float, y:Float, noteData:Int = 0):Void + { + super(x, y); + + frames = Paths.getSparrowAtlas('noteSplashes'); + + animation.addByPrefix('note1-0', 'note impact 1 blue', 24, false); + animation.addByPrefix('note2-0', 'note impact 1 green', 24, false); + animation.addByPrefix('note0-0', 'note impact 1 purple', 24, false); + animation.addByPrefix('note3-0', 'note impact 1 red', 24, false); + animation.addByPrefix('note1-1', 'note impact 2 blue', 24, false); + animation.addByPrefix('note2-1', 'note impact 2 green', 24, false); + animation.addByPrefix('note0-1', 'note impact 2 purple', 24, false); + animation.addByPrefix('note3-1', 'note impact 2 red', 24, false); + + animation.play('note' + noteData + '-' + FlxG.random.int(0, 1)); + animation.curAnim.frameRate += FlxG.random.int(-2, 2); + updateHitbox(); + + offset.set(width * 0.3, height * 0.3); + } + + override function update(elapsed:Float) + { + if (animation.curAnim.finished) + kill(); + + super.update(elapsed); + } +} diff --git a/source/PlayState.hx b/source/PlayState.hx index 0c95bbf53..cc08460ce 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1792,7 +1792,7 @@ class PlayState extends MusicBeatState var endingSong:Bool = false; - private function popUpScore(strumtime:Float):Void + private function popUpScore(strumtime:Float, daNote:Note):Void { var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition); // boyfriend.playAnim('hey'); @@ -1810,20 +1810,33 @@ class PlayState extends MusicBeatState var daRating:String = "sick"; + var isSick:Bool = true; + if (noteDiff > Conductor.safeZoneOffset * 0.9) { daRating = 'shit'; score = 50; + isSick = false; // shitty copypaste on this literally just because im lazy and tired lol! } else if (noteDiff > Conductor.safeZoneOffset * 0.75) { daRating = 'bad'; score = 100; + isSick = false; } else if (noteDiff > Conductor.safeZoneOffset * 0.2) { daRating = 'good'; score = 200; + isSick = false; + } + + if (isSick) + { + var noteSplash:NoteSplash = new NoteSplash(daNote.x, daNote.y, daNote.noteData); + add(noteSplash); + + noteSplash.cameras = [camHUD]; } songScore += score; @@ -2272,7 +2285,7 @@ class PlayState extends MusicBeatState { if (!note.isSustainNote) { - popUpScore(note.strumTime); + popUpScore(note.strumTime, note); combo += 1; } diff --git a/source/ui/SettingsMenu.hx b/source/ui/SettingsMenu.hx new file mode 100644 index 000000000..179ff4100 --- /dev/null +++ b/source/ui/SettingsMenu.hx @@ -0,0 +1,9 @@ +package ui; + +class SettingsMenu extends ui.OptionsState.Page +{ + public function new() + { + super(); + } +}