diff --git a/buildnumber.txt b/buildnumber.txt index 39dcb9cb..c84224b2 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2405 \ No newline at end of file +2414 \ No newline at end of file diff --git a/source/funkin/editors/CharacterEditor.hx b/source/funkin/editors/CharacterEditor.hx deleted file mode 100644 index b2c13605..00000000 --- a/source/funkin/editors/CharacterEditor.hx +++ /dev/null @@ -1,36 +0,0 @@ -package funkin.editors; - -import funkin.desktop.DesktopMain; -import flixel.FlxState; -import funkin.game.*; - -class CharacterEditor extends MusicBeatState { - public var character:Character; - public var characterName:String; - - private var oldState:Class = null; - public function new(char:String) { - super(); - this.characterName = char; - if (!(FlxG.state is DesktopMain)) - oldState = Type.getClass(FlxG.state); - } - - public override function create() { - super.create(); - - add(new Stage("default")); - - character = new Character(770, 100, characterName, true); - characterName = character.curCharacter; - add(character); - - trace(members); - } - - public override function update(elapsed:Float) { - super.update(elapsed); - if (controls.BACK && oldState != null) - FlxG.switchState(Type.createInstance(oldState, [])); - } -} \ No newline at end of file diff --git a/source/funkin/editors/EditorPicker.hx b/source/funkin/editors/EditorPicker.hx index 8c1a08b5..bcb62595 100644 --- a/source/funkin/editors/EditorPicker.hx +++ b/source/funkin/editors/EditorPicker.hx @@ -1,7 +1,9 @@ package funkin.editors; +import flixel.addons.transition.FlxTransitionableState; +import funkin.options.Options; import flixel.math.FlxPoint; - +import flixel.effects.FlxFlicker; class EditorPicker extends MusicBeatSubstate { public var bg:FlxSprite; @@ -49,6 +51,10 @@ class EditorPicker extends MusicBeatSubstate { public var optionHeight:Float = 0; + public var selected:Bool = false; + + public var camVelocity:Float = 0; + public override function create() { super.create(); @@ -57,6 +63,7 @@ class EditorPicker extends MusicBeatSubstate { FlxG.cameras.add(camera); bg = new FlxSprite().makeGraphic(1, 1, 0xFF000000); + bg.scrollFactor.set(); bg.scale.set(FlxG.width, FlxG.height); bg.updateHitbox(); bg.alpha = 0; @@ -77,7 +84,13 @@ class EditorPicker extends MusicBeatSubstate { public override function update(elapsed:Float) { super.update(elapsed); - bg.alpha = CoolUtil.fpsLerp(bg.alpha, 0.5, 0.25); + bg.alpha = CoolUtil.fpsLerp(bg.alpha, selected ? 1 : 0.5, 0.25); + + if (selected) { + camVelocity += FlxG.width * elapsed * 2; + camera.scroll.x += camVelocity * elapsed; + return; + } changeSelection(-FlxG.mouse.wheel + (controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0)); FlxG.mouse.getScreenPosition(camera, curMousePos); @@ -86,6 +99,27 @@ class EditorPicker extends MusicBeatSubstate { curSelected = -1; changeSelection(Std.int(curMousePos.y / optionHeight)+1); } + + if (controls.ACCEPT || FlxG.mouse.justReleased) { + selected = true; + CoolUtil.playMenuSFX(CONFIRM); + + FlxTransitionableState.skipNextTransIn = true; + FlxTransitionableState.skipNextTransOut = true; + + FlxG.sound.music.fadeOut(0.7, 0, function(n) { + FlxG.sound.music.stop(); + }); + + sprites[curSelected].flicker(function() { + if (FlxG.sound.music != null) + camera.fade(0xFF000000, 0.25, false, function() { + FlxG.switchState(Type.createInstance(options[curSelected].state, [])); + }); + }); + } + if (controls.BACK) + close(); } public function changeSelection(change:Int) { @@ -159,10 +193,17 @@ class EditorPickerOption extends FlxTypedSpriteGroup { iconSpr.x = label.x - 25 - iconSpr.width; iconSpr.angle = Math.sin(iconRotationCycle * 0.5) * 5; - scrollFactor.set(selectionLerp, 0); + scrollFactor.set(FlxMath.lerp(1, 0.1, selectionLerp), 0); + selectionBG.scrollFactor.set(0, 0); } public override function destroy() { super.destroy(); } + + public function flicker(callback:Void->Void) { + FlxFlicker.flicker(label, 0.5, Options.flashingMenu ? 0.06 : 0.15, false, false, function(t) { + callback(); + }); + } } \ No newline at end of file