diff --git a/source/Character.hx b/source/Character.hx index 810d210..eb8158f 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -124,7 +124,7 @@ class Character extends FlxSprite case 'dad': // DAD ANIMATION LOADING CODE - tex = Paths.getSparrowAtlas('DADDY_DEAREST'); + tex = Paths.getSparrowAtlas('DADDY_DEAREST','shared'); frames = tex; animation.addByPrefix('idle', 'Dad idle dance', 24); animation.addByPrefix('singUP', 'Dad Sing Note UP', 24); @@ -267,7 +267,7 @@ class Character extends FlxSprite flipX = true; case 'bf': - var tex = Paths.getSparrowAtlas('BOYFRIEND'); + var tex = Paths.getSparrowAtlas('BOYFRIEND','shared'); frames = tex; animation.addByPrefix('idle', 'BF idle dance', 24, false); animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false); diff --git a/source/GameplayCustomizeState.hx b/source/GameplayCustomizeState.hx new file mode 100644 index 0000000..9cf8b93 --- /dev/null +++ b/source/GameplayCustomizeState.hx @@ -0,0 +1,176 @@ +import flixel.math.FlxPoint; +import flixel.FlxObject; +#if desktop +import Discord.DiscordClient; +import sys.thread.Thread; +#end + +import flixel.group.FlxGroup.FlxTypedGroup; +import openfl.ui.Keyboard; +import flixel.FlxSprite; +import flixel.FlxG; + +class GameplayCustomizeState extends MusicBeatState +{ + + var defaultX:Float = FlxG.width * 0.55 - 135; + var defaultY:Float = FlxG.height / 2 - 50; + + var background:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback','shared')); + var curt:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains','shared')); + var front:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront','shared')); + + var sick:FlxSprite = new FlxSprite().loadGraphic(Paths.image('sick','shared')); + + var bf:Boyfriend = new Boyfriend(770, 450, 'bf'); + var dad:Character; + + var strumLine:FlxSprite; + var strumLineNotes:FlxTypedGroup; + var playerStrums:FlxTypedGroup; + + override function create() { + #if desktop + // Updating Discord Rich Presence + DiscordClient.changePresence("Customizing Gameplay", null); + #end + + background.scrollFactor.set(0.9,0.9); + curt.scrollFactor.set(0.9,0.9); + front.scrollFactor.set(0.9,0.9); + + add(background); + add(front); + add(curt); + + + add(sick); + + bf.playAnim('idle'); + + var camFollow = new FlxObject(0, 0, 1, 1); + + dad = new Character(100, 100, 'dad'); + + var camPos:FlxPoint = new FlxPoint(dad.getGraphicMidpoint().x + 400, dad.getGraphicMidpoint().y); + + camFollow.setPosition(camPos.x, camPos.y); + + add(bf); + add(dad); + + add(camFollow); + + FlxG.camera.follow(camFollow, LOCKON, 0.01); + // FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height); + FlxG.camera.zoom = 0.9; + FlxG.camera.focusOn(camFollow.getPosition()); + + strumLine = new FlxSprite(0, 25).makeGraphic(FlxG.width, 10); + strumLine.scrollFactor.set(); + + if (FlxG.save.data.downscroll) + strumLine.y = FlxG.height - 165; + + strumLineNotes = new FlxTypedGroup(); + add(strumLineNotes); + + playerStrums = new FlxTypedGroup(); + + generateStaticArrows(0); + generateStaticArrows(1); + + if (!FlxG.save.data.changedHit) + { + FlxG.save.data.changedHitX = defaultX; + FlxG.save.data.changedHitY = defaultY; + } + + sick.x = FlxG.save.data.changedHitX; + sick.y = FlxG.save.data.changedHitY; + + FlxG.mouse.visible = true; + } + + override function update(elapsed:Float) { + bf.playAnim('idle'); + dad.dance(); + + if (FlxG.mouse.overlaps(sick) && FlxG.mouse.pressed) + { + sick.x = FlxG.mouse.x - sick.width / 2; + sick.y = FlxG.mouse.y - sick.height / 2; + } + + if (FlxG.mouse.overlaps(sick) && FlxG.mouse.justReleased) + { + FlxG.save.data.changedHitX = sick.x; + FlxG.save.data.changedHitY = sick.y; + FlxG.save.data.changedHit = true; + } + + if (controls.BACK) + { + FlxG.mouse.visible = false; + FlxG.sound.play(Paths.sound('cancelMenu')); + FlxG.switchState(new OptionsMenu()); + } + } + + + // ripped from play state cuz im lazy + + private function generateStaticArrows(player:Int):Void + { + for (i in 0...4) + { + // FlxG.log.add(i); + var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y); + babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets', 'shared'); + babyArrow.animation.addByPrefix('green', 'arrowUP'); + babyArrow.animation.addByPrefix('blue', 'arrowDOWN'); + babyArrow.animation.addByPrefix('purple', 'arrowLEFT'); + babyArrow.animation.addByPrefix('red', 'arrowRIGHT'); + babyArrow.antialiasing = true; + babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7)); + switch (Math.abs(i)) + { + case 0: + babyArrow.x += Note.swagWidth * 0; + babyArrow.animation.addByPrefix('static', 'arrowLEFT'); + babyArrow.animation.addByPrefix('pressed', 'left press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false); + case 1: + babyArrow.x += Note.swagWidth * 1; + babyArrow.animation.addByPrefix('static', 'arrowDOWN'); + babyArrow.animation.addByPrefix('pressed', 'down press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false); + case 2: + babyArrow.x += Note.swagWidth * 2; + babyArrow.animation.addByPrefix('static', 'arrowUP'); + babyArrow.animation.addByPrefix('pressed', 'up press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false); + case 3: + babyArrow.x += Note.swagWidth * 3; + babyArrow.animation.addByPrefix('static', 'arrowRIGHT'); + babyArrow.animation.addByPrefix('pressed', 'right press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false); + } + babyArrow.updateHitbox(); + babyArrow.scrollFactor.set(); + + babyArrow.ID = i; + + if (player == 1) + { + playerStrums.add(babyArrow); + } + + babyArrow.animation.play('static'); + babyArrow.x += 50; + babyArrow.x += ((FlxG.width / 2) * player); + + strumLineNotes.add(babyArrow); + } + } +} \ No newline at end of file diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx index ff967e9..f8b9f18 100644 --- a/source/HealthIcon.hx +++ b/source/HealthIcon.hx @@ -12,6 +12,7 @@ class HealthIcon extends FlxSprite public function new(char:String = 'bf', isPlayer:Bool = false) { super(); + trace(Paths.image('iconGrid','data')); loadGraphic(Paths.image('iconGrid'), true, 150, 150); antialiasing = true; diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index 40bc098..b01a47a 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -30,5 +30,12 @@ class KadeEngineData if (FlxG.save.data.fps == null) FlxG.save.data.fps = false; + + if (FlxG.save.data.changedHit == null) + { + FlxG.save.data.changedHitX = -1; + FlxG.save.data.changedHitY = -1; + FlxG.save.data.changedHit = false; + } } } diff --git a/source/Note.hx b/source/Note.hx index 264979b..78118a9 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -33,15 +33,14 @@ class Note extends FlxSprite public static var BLUE_NOTE:Int = 1; public static var RED_NOTE:Int = 3; + public var rating:String = "shit"; + public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false) { super(); if (prevNote == null) prevNote = this; - - if (FlxG.save.data.downscroll) - flipY = true; this.prevNote = prevNote; isSustainNote = sustainNote; @@ -74,18 +73,10 @@ class Note extends FlxSprite { loadGraphic(Paths.image('weeb/pixelUI/arrowEnds'), true, 7, 6); - if(!FlxG.save.data.downscroll) - { animation.add('purpleholdend', [4]); animation.add('greenholdend', [6]); animation.add('redholdend', [7]); animation.add('blueholdend', [5]); - }else { - animation.add('purpleholdend', [4], 0, false, false, true); - animation.add('greenholdend', [6], 0, false, false, true); - animation.add('redholdend', [7], 0, false, false, true); - animation.add('blueholdend', [5], 0, false, false, true); - } } setGraphicSize(Std.int(width * PlayState.daPixelZoom)); @@ -103,19 +94,11 @@ class Note extends FlxSprite animation.addByPrefix('greenhold', 'green hold piece'); animation.addByPrefix('redhold', 'red hold piece'); animation.addByPrefix('bluehold', 'blue hold piece'); - - if(!FlxG.save.data.downscroll) - { + animation.addByPrefix('purpleholdend', 'pruple end hold'); animation.addByPrefix('greenholdend', 'green hold end'); animation.addByPrefix('redholdend', 'red hold end'); animation.addByPrefix('blueholdend', 'blue hold end'); - }else { - animation.addByPrefix('purpleholdend', 'pruple end hold', 0, false, false, true); - animation.addByPrefix('greenholdend', 'green hold end', 0, false, false, true); - animation.addByPrefix('redholdend', 'red hold end', 0, false, false, true); - animation.addByPrefix('blueholdend', 'blue hold end', 0, false, false, true); - } setGraphicSize(Std.int(width * 0.7)); updateHitbox(); @@ -138,7 +121,12 @@ class Note extends FlxSprite animation.play('redScroll'); } - + // we make sure its downscroll and its a SUSTAIN NOTE (aka a trail, not a note) + // and flip it so it doesn't look weird. + // THIS DOESN'T FUCKING FLIP THE NOTE, CONTRIBUTERS DON'T JUST COMMENT THIS OUT JESUS + if (FlxG.save.data.downscroll && sustainNote) + flipY = true; + if (isSustainNote && prevNote != null) { noteScore * 0.2; @@ -192,15 +180,38 @@ class Note extends FlxSprite if (mustPress) { - // The * 0.5 is so that it's easier to hit them too late, instead of too early if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset - && strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5)) + && strumTime < Conductor.songPosition + Conductor.safeZoneOffset) canBeHit = true; else canBeHit = false; - if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset && !wasGoodHit) + var noteDiff:Float = Math.abs(strumTime - Conductor.songPosition); + + if (canBeHit) + { + if (noteDiff > Conductor.safeZoneOffset * 0.95) + rating = "shit"; + else if (noteDiff < Conductor.safeZoneOffset * -0.95) + rating = "shit"; + else if (noteDiff > Conductor.safeZoneOffset * 0.70) + rating = "bad"; + else if (noteDiff < Conductor.safeZoneOffset * -0.75) + rating = "bad"; + else if (noteDiff > Conductor.safeZoneOffset * 0.45) + rating = "good"; + else if (noteDiff < Conductor.safeZoneOffset * -0.45) + rating = "good"; + else + rating = "sick"; + FlxG.watch.addQuick("Note " + this.ID,rating); + } + + if (strumTime < Conductor.songPosition - (Conductor.safeZoneOffset * 0.80) && !wasGoodHit) + { tooLate = true; + rating = "shit"; + } } else { diff --git a/source/Options.hx b/source/Options.hx index 5278124..864e788 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -52,21 +52,6 @@ class DFJKOption extends Option } } -class NewInputOption extends Option -{ - public override function press():Bool - { - FlxG.save.data.newInput = !FlxG.save.data.newInput; - display = updateDisplay(); - return true; - } - - private override function updateDisplay():String - { - return FlxG.save.data.newInput ? "New input" : "Old Input"; - } -} - class DownscrollOption extends Option { public override function press():Bool @@ -157,3 +142,19 @@ class ReplayOption extends Option return "Load replays"; } } + +class CustomizeGameplay extends Option +{ + public override function press():Bool + { + trace("switch"); + FlxG.switchState(new GameplayCustomizeState()); + return false; + } + + private override function updateDisplay():String + { + return "Customize Gameplay"; + } +} + diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 3175ec7..717a341 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -20,7 +20,6 @@ class OptionsMenu extends MusicBeatState var options:Array