diff --git a/source/Alphabet.hx b/source/Alphabet.hx index 77ac5dc..6f7e711 100644 --- a/source/Alphabet.hx +++ b/source/Alphabet.hx @@ -224,8 +224,8 @@ class Alphabet extends FlxSpriteGroup { var scaledY = FlxMath.remapToRange(targetY, 0, 1, 0, 1.3); - y = FlxMath.lerp(y, (scaledY * 120) + (FlxG.height * 0.48), 0.16); - x = FlxMath.lerp(x, (targetY * 20) + 90, 0.16); + y = FlxMath.lerp(y, (scaledY * 120) + (FlxG.height * 0.48), 0.30); + x = FlxMath.lerp(x, (targetY * 20) + 90, 0.30); } super.update(elapsed); diff --git a/source/GameplayCustomizeState.hx b/source/GameplayCustomizeState.hx index 9cf8b93..355691e 100644 --- a/source/GameplayCustomizeState.hx +++ b/source/GameplayCustomizeState.hx @@ -1,3 +1,5 @@ +import flixel.math.FlxMath; +import flixel.FlxCamera; import flixel.math.FlxPoint; import flixel.FlxObject; #if desktop @@ -28,13 +30,23 @@ class GameplayCustomizeState extends MusicBeatState var strumLine:FlxSprite; var strumLineNotes:FlxTypedGroup; var playerStrums:FlxTypedGroup; - - override function create() { + private var camHUD:FlxCamera; + + public override function create() { #if desktop // Updating Discord Rich Presence DiscordClient.changePresence("Customizing Gameplay", null); #end + Conductor.changeBPM(102); + persistentUpdate = true; + + super.create(); + + camHUD = new FlxCamera(); + camHUD.bgColor.alpha = 0; + FlxG.cameras.add(camHUD); + background.scrollFactor.set(0.9,0.9); curt.scrollFactor.set(0.9,0.9); front.scrollFactor.set(0.9,0.9); @@ -43,11 +55,6 @@ class GameplayCustomizeState extends MusicBeatState add(front); add(curt); - - add(sick); - - bf.playAnim('idle'); - var camFollow = new FlxObject(0, 0, 1, 1); dad = new Character(100, 100, 'dad'); @@ -59,6 +66,8 @@ class GameplayCustomizeState extends MusicBeatState add(bf); add(dad); + add(sick); + add(camFollow); FlxG.camera.follow(camFollow, LOCKON, 0.01); @@ -77,9 +86,14 @@ class GameplayCustomizeState extends MusicBeatState playerStrums = new FlxTypedGroup(); + sick.cameras = [camHUD]; + strumLine.cameras = [camHUD]; + playerStrums.cameras = [camHUD]; + generateStaticArrows(0); generateStaticArrows(1); + if (!FlxG.save.data.changedHit) { FlxG.save.data.changedHitX = defaultX; @@ -89,12 +103,20 @@ class GameplayCustomizeState extends MusicBeatState sick.x = FlxG.save.data.changedHitX; sick.y = FlxG.save.data.changedHitY; + sick.updateHitbox(); + FlxG.mouse.visible = true; + } override function update(elapsed:Float) { - bf.playAnim('idle'); - dad.dance(); + if (FlxG.sound.music != null) + Conductor.songPosition = FlxG.sound.music.time; + + super.update(elapsed); + + FlxG.camera.zoom = FlxMath.lerp(0.9, FlxG.camera.zoom, 0.95); + camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95); if (FlxG.mouse.overlaps(sick) && FlxG.mouse.pressed) { @@ -115,6 +137,21 @@ class GameplayCustomizeState extends MusicBeatState FlxG.sound.play(Paths.sound('cancelMenu')); FlxG.switchState(new OptionsMenu()); } + + } + + override function beatHit() + { + super.beatHit(); + + bf.playAnim('idle'); + dad.dance(); + + FlxG.camera.zoom += 0.015; + camHUD.zoom += 0.010; + + trace('beat'); + } diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index b01a47a..a5b9d00 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -1,3 +1,4 @@ +import openfl.Lib; import flixel.FlxG; class KadeEngineData @@ -37,5 +38,19 @@ class KadeEngineData FlxG.save.data.changedHitY = -1; FlxG.save.data.changedHit = false; } + + if (FlxG.save.data.fpsRain == null) + FlxG.save.data.fpsRain = false; + + if (FlxG.save.data.fpsCap == null) + FlxG.save.data.fpsCap = 120; + + if (FlxG.save.data.fpsCap > 285 || FlxG.save.data.fpsCap < 60) + FlxG.save.data.fpsCap = 120; // baby proof so you can't hard lock ur copy of kade engine + + if (FlxG.save.data.scrollSpeed == null) + FlxG.save.data.scrollSpeed = 1; + + (cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap); } } diff --git a/source/Main.hx b/source/Main.hx index 8adf2db..9ad6652 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -1,5 +1,9 @@ package; +import openfl.display.BlendMode; +import openfl.text.TextFormat; +import openfl.display.Application; +import flixel.util.FlxColor; import flixel.FlxG; import flixel.FlxGame; import flixel.FlxState; @@ -68,7 +72,9 @@ class Main extends Sprite initialState = TitleState; #end - addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen)); + game = new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen); + + addChild(game); #if !mobile fpsCounter = new FPS(10, 3, 0xFFFFFF); @@ -77,9 +83,31 @@ class Main extends Sprite #end } + var game:FlxGame; + var fpsCounter:FPS; public function toggleFPS(fpsEnabled:Bool):Void { fpsCounter.visible = fpsEnabled; } + + public function changeFPSColor(color:FlxColor) + { + fpsCounter.textColor = color; + } + + public function setFPSCap(cap:Float) + { + openfl.Lib.current.stage.frameRate = cap; + } + + public function getFPSCap():Float + { + return openfl.Lib.current.stage.frameRate; + } + + public function getFPS():Float + { + return fpsCounter.currentFPS; + } } diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 7309699..7269107 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -36,7 +36,9 @@ class MainMenuState extends MusicBeatState var newGaming2:FlxText; var newInput:Bool = true; - public static var kadeEngineVer:String = "1.3.1"; + public static var nightly:String = "-Nightly.2"; + + public static var kadeEngineVer:String = "1.3.1" + nightly; public static var gameVer:String = "0.2.7.1"; var magenta:FlxSprite; @@ -99,7 +101,7 @@ class MainMenuState extends MusicBeatState menuItem.antialiasing = true; } - FlxG.camera.follow(camFollow, null, 0.06); + FlxG.camera.follow(camFollow, null, 0.60 * (60 / FlxG.save.data.fpsCap)); var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, gameVer + " FNF - " + kadeEngineVer + " Kade Engine", 12); versionShit.scrollFactor.set(); diff --git a/source/MenuItem.hx b/source/MenuItem.hx index f41d893..44353f8 100644 --- a/source/MenuItem.hx +++ b/source/MenuItem.hx @@ -36,7 +36,7 @@ class MenuItem extends FlxSpriteGroup override function update(elapsed:Float) { super.update(elapsed); - y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17); + y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17 * (60 / FlxG.save.data.fpsCap)); if (isFlashing) flashingInt += 1; diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index 88c58a6..77df9aa 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -1,5 +1,8 @@ package; +import flixel.tweens.FlxTween; +import flixel.util.FlxColor; +import openfl.Lib; import Conductor.BPMChangeEvent; import flixel.FlxG; import flixel.addons.transition.FlxTransitionableState; @@ -27,6 +30,18 @@ class MusicBeatState extends FlxUIState super.create(); } + var array:Array = [ + FlxColor.fromRGB(148, 0, 211), + FlxColor.fromRGB(75, 0, 130), + FlxColor.fromRGB(0, 0, 255), + FlxColor.fromRGB(0, 255, 0), + FlxColor.fromRGB(255, 255, 0), + FlxColor.fromRGB(255, 127, 0), + FlxColor.fromRGB(255, 0 , 0) + ]; + + var skippedFrames = 0; + override function update(elapsed:Float) { //everyStep(); @@ -38,6 +53,17 @@ class MusicBeatState extends FlxUIState if (oldStep != curStep && curStep > 0) stepHit(); + if (FlxG.save.data.fpsRain && skippedFrames >= 6) + { + if (currentColor >= array.length) + currentColor = 0; + (cast (Lib.current.getChildAt(0), Main)).changeFPSColor(array[currentColor]); + currentColor++; + skippedFrames = 0; + } + else + skippedFrames++; + super.update(elapsed); } @@ -46,6 +72,8 @@ class MusicBeatState extends FlxUIState curBeat = Math.floor(curStep / 4); } + public static var currentColor = 0; + private function updateCurStep():Void { var lastChange:BPMChangeEvent = { @@ -64,6 +92,7 @@ class MusicBeatState extends FlxUIState public function stepHit():Void { + if (curStep % 4 == 0) beatHit(); } diff --git a/source/Note.hx b/source/Note.hx index 78118a9..750940f 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -63,20 +63,20 @@ class Note extends FlxSprite animation.add('redScroll', [7]); animation.add('blueScroll', [5]); animation.add('purpleScroll', [4]); - - animation.add('purplehold', [0]); - animation.add('greenhold', [2]); - animation.add('redhold', [3]); - animation.add('bluehold', [1]); - + if (isSustainNote) { loadGraphic(Paths.image('weeb/pixelUI/arrowEnds'), true, 7, 6); - animation.add('purpleholdend', [4]); - animation.add('greenholdend', [6]); - animation.add('redholdend', [7]); - animation.add('blueholdend', [5]); + animation.add('purpleholdend', [4]); + animation.add('greenholdend', [6]); + animation.add('redholdend', [7]); + animation.add('blueholdend', [5]); + + animation.add('purplehold', [0]); + animation.add('greenhold', [2]); + animation.add('redhold', [3]); + animation.add('bluehold', [1]); } setGraphicSize(Std.int(width * PlayState.daPixelZoom)); @@ -89,17 +89,17 @@ class Note extends FlxSprite animation.addByPrefix('redScroll', 'red0'); animation.addByPrefix('blueScroll', 'blue0'); animation.addByPrefix('purpleScroll', 'purple0'); - + + animation.addByPrefix('purpleholdend', 'pruple end hold'); + animation.addByPrefix('greenholdend', 'green hold end'); + animation.addByPrefix('redholdend', 'red hold end'); + animation.addByPrefix('blueholdend', 'blue hold end'); + animation.addByPrefix('purplehold', 'purple hold piece'); animation.addByPrefix('greenhold', 'green hold piece'); animation.addByPrefix('redhold', 'red hold piece'); animation.addByPrefix('bluehold', 'blue hold piece'); - animation.addByPrefix('purpleholdend', 'pruple end hold'); - animation.addByPrefix('greenholdend', 'green hold end'); - animation.addByPrefix('redholdend', 'red hold end'); - animation.addByPrefix('blueholdend', 'blue hold end'); - setGraphicSize(Std.int(width * 0.7)); updateHitbox(); antialiasing = true; @@ -127,87 +127,71 @@ class Note extends FlxSprite if (FlxG.save.data.downscroll && sustainNote) flipY = true; + if (isSustainNote && prevNote != null) - { - noteScore * 0.2; - alpha = 0.6; - - x += width / 2; - - switch (noteData) { - case 2: - animation.play('greenholdend'); - case 3: - animation.play('redholdend'); - case 1: - animation.play('blueholdend'); - case 0: - animation.play('purpleholdend'); - } - - updateHitbox(); - - x -= width / 2; - - if (PlayState.curStage.startsWith('school')) - x += 30; - - if (prevNote.isSustainNote) - { - switch (prevNote.noteData) + noteScore * 0.2; + alpha = 0.6; + + x += width / 2; + + switch (noteData) { - case 0: - prevNote.animation.play('purplehold'); - case 1: - prevNote.animation.play('bluehold'); case 2: - prevNote.animation.play('greenhold'); + animation.play('greenholdend'); case 3: - prevNote.animation.play('redhold'); + animation.play('redholdend'); + case 1: + animation.play('blueholdend'); + case 0: + animation.play('purpleholdend'); + } + + updateHitbox(); + + x -= width / 2; + + if (PlayState.curStage.startsWith('school')) + x += 30; + + if (prevNote.isSustainNote) + { + switch (prevNote.noteData) + { + case 0: + prevNote.animation.play('purplehold'); + case 1: + prevNote.animation.play('bluehold'); + case 2: + prevNote.animation.play('greenhold'); + case 3: + prevNote.animation.play('redhold'); + } + + prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed; + prevNote.updateHitbox(); + // prevNote.setGraphicSize(); } - - prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed; - prevNote.updateHitbox(); - // prevNote.setGraphicSize(); } - } } + var oneTime:Bool = false; + override function update(elapsed:Float) { super.update(elapsed); if (mustPress) { - if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset - && strumTime < Conductor.songPosition + Conductor.safeZoneOffset) + if ((strumTime > Conductor.songPosition - Conductor.safeZoneOffset + && strumTime < Conductor.songPosition + Conductor.safeZoneOffset)) + { canBeHit = true; + } else canBeHit = false; - 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) + if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset && !wasGoodHit) { tooLate = true; rating = "shit"; diff --git a/source/Options.hx b/source/Options.hx index 864e788..f9f6c42 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -1,23 +1,60 @@ package; +import flixel.util.FlxColor; import Controls.KeyboardScheme; import flixel.FlxG; import openfl.display.FPS; import openfl.Lib; +class OptionCatagory +{ + private var _options:Array