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/Options.hx b/source/Options.hx index 5278124..ad6d802 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -157,3 +157,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..4155b92 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -28,6 +28,7 @@ class OptionsMenu extends MusicBeatState new FPSOption(), #end new EtternaModeOption(), + new CustomizeGameplay(), new ReplayOption() ]; diff --git a/source/PlayState.hx b/source/PlayState.hx index 0d00afa..c2bb222 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2160,6 +2160,12 @@ class PlayState extends MusicBeatState rating.screenCenter(); rating.y -= 50; rating.x = coolText.x - 125; + + if (FlxG.save.data.changedHit) + { + rating.x = FlxG.save.data.changedHitX; + rating.y = FlxG.save.data.changedHitY; + } rating.acceleration.y = 550; rating.velocity.y -= FlxG.random.int(140, 175); rating.velocity.x -= FlxG.random.int(0, 10);