2022-03-08 03:13:53 -05:00
|
|
|
package funkin;
|
2021-04-07 20:19:49 -04:00
|
|
|
|
2023-04-06 01:39:27 -04:00
|
|
|
import funkin.ui.StickerSubState;
|
2020-11-06 21:17:27 -05:00
|
|
|
import flash.text.TextField;
|
2021-08-21 20:45:03 -04:00
|
|
|
import flixel.FlxCamera;
|
|
|
|
import flixel.FlxGame;
|
2020-10-21 14:05:27 -04:00
|
|
|
import flixel.FlxSprite;
|
2021-06-07 21:14:50 -04:00
|
|
|
import flixel.FlxState;
|
2020-10-25 16:51:06 -04:00
|
|
|
import flixel.addons.display.FlxGridOverlay;
|
2021-10-21 23:08:48 -04:00
|
|
|
import flixel.addons.transition.FlxTransitionableState;
|
2022-09-26 18:22:45 -04:00
|
|
|
import flixel.addons.ui.FlxInputText;
|
2020-11-01 14:16:22 -05:00
|
|
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
2021-10-21 23:08:48 -04:00
|
|
|
import flixel.group.FlxGroup;
|
2021-12-07 17:41:18 -05:00
|
|
|
import flixel.group.FlxSpriteGroup;
|
2021-08-21 19:53:08 -04:00
|
|
|
import flixel.input.touch.FlxTouch;
|
2021-08-24 15:28:04 -04:00
|
|
|
import flixel.math.FlxAngle;
|
2020-11-06 21:17:27 -05:00
|
|
|
import flixel.math.FlxMath;
|
2021-08-24 15:28:04 -04:00
|
|
|
import flixel.math.FlxPoint;
|
2020-10-21 14:05:27 -04:00
|
|
|
import flixel.text.FlxText;
|
2021-10-21 23:08:48 -04:00
|
|
|
import flixel.tweens.FlxEase;
|
2021-03-02 00:46:28 -05:00
|
|
|
import flixel.tweens.FlxTween;
|
2020-11-06 21:17:27 -05:00
|
|
|
import flixel.util.FlxColor;
|
2023-09-08 17:46:44 -04:00
|
|
|
import funkin.data.song.SongRegistry;
|
2021-10-21 23:08:48 -04:00
|
|
|
import flixel.util.FlxSpriteUtil;
|
2021-10-21 17:40:53 -04:00
|
|
|
import flixel.util.FlxTimer;
|
2022-03-23 23:27:48 -04:00
|
|
|
import funkin.Controls.Control;
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.freeplayStuff.BGScrollingText;
|
|
|
|
import funkin.freeplayStuff.DJBoyfriend;
|
|
|
|
import funkin.freeplayStuff.FreeplayScore;
|
2022-09-27 04:37:42 -04:00
|
|
|
import funkin.freeplayStuff.LetterSort;
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.freeplayStuff.SongMenuItem;
|
2022-03-25 22:30:37 -04:00
|
|
|
import funkin.play.HealthIcon;
|
2022-03-23 23:27:48 -04:00
|
|
|
import funkin.play.PlayState;
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.shaderslmfao.AngleMask;
|
|
|
|
import funkin.shaderslmfao.PureColor;
|
|
|
|
import funkin.shaderslmfao.StrokeShader;
|
2023-06-02 15:35:01 -04:00
|
|
|
import funkin.play.PlayStatePlaylist;
|
|
|
|
import funkin.play.song.Song;
|
2022-03-23 23:27:48 -04:00
|
|
|
import lime.app.Future;
|
|
|
|
import lime.utils.Assets;
|
2023-08-09 19:34:19 -04:00
|
|
|
import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2023-06-01 18:52:58 -04:00
|
|
|
class FreeplayState extends MusicBeatSubState
|
2020-10-21 14:05:27 -04:00
|
|
|
{
|
2023-06-09 18:25:21 -04:00
|
|
|
var songs:Array<FreeplaySongData> = [];
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
// var selector:FlxText;
|
|
|
|
var curSelected:Int = 0;
|
|
|
|
var curDifficulty:Int = 1;
|
2020-11-06 21:17:27 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var fp:FreeplayScore;
|
|
|
|
var txtCompletion:FlxText;
|
|
|
|
var lerpCompletion:Float = 0;
|
|
|
|
var intendedCompletion:Float = 0;
|
|
|
|
var lerpScore:Float = 0;
|
|
|
|
var intendedScore:Int = 0;
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var grpDifficulties:FlxSpriteGroup;
|
2021-12-07 17:41:18 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var coolColors:Array<Int> = [
|
|
|
|
0xff9271fd,
|
|
|
|
0xff9271fd,
|
|
|
|
0xff223344,
|
|
|
|
0xFF941653,
|
|
|
|
0xFFfc96d7,
|
|
|
|
0xFFa0d1ff,
|
|
|
|
0xffff78bf,
|
|
|
|
0xfff6b604
|
|
|
|
];
|
2021-03-02 00:46:28 -05:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
var grpSongs:FlxTypedGroup<Alphabet>;
|
|
|
|
var grpCapsules:FlxTypedGroup<SongMenuItem>;
|
|
|
|
var curPlaying:Bool = false;
|
2020-11-01 14:16:22 -05:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
var dj:DJBoyfriend;
|
2022-11-15 02:23:44 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var typing:FlxInputText;
|
2023-03-16 00:17:52 -04:00
|
|
|
var exitMovers:Map<Array<FlxSprite>, MoveData> = new Map();
|
2022-09-26 18:22:45 -04:00
|
|
|
|
2023-04-06 01:39:27 -04:00
|
|
|
var stickerSubState:StickerSubState;
|
|
|
|
|
|
|
|
public function new(?stickers:StickerSubState = null)
|
|
|
|
{
|
|
|
|
if (stickers != null)
|
|
|
|
{
|
|
|
|
stickerSubState = stickers;
|
|
|
|
}
|
|
|
|
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
override function create():Void
|
2023-01-22 19:55:30 -05:00
|
|
|
{
|
2023-04-06 01:39:27 -04:00
|
|
|
super.create();
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
FlxTransitionableState.skipNextTransIn = true;
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-04-06 01:39:27 -04:00
|
|
|
if (stickerSubState != null)
|
|
|
|
{
|
|
|
|
this.persistentUpdate = true;
|
|
|
|
this.persistentDraw = true;
|
|
|
|
|
|
|
|
openSubState(stickerSubState);
|
|
|
|
stickerSubState.degenStickers();
|
|
|
|
|
|
|
|
// resetSubState();
|
|
|
|
}
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
#if discord_rpc
|
|
|
|
// Updating Discord Rich Presence
|
|
|
|
DiscordClient.changePresence("In the Menus", null);
|
|
|
|
#end
|
2021-05-06 06:54:57 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var isDebug:Bool = false;
|
2021-05-06 06:54:57 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
#if debug
|
|
|
|
isDebug = true;
|
2023-06-09 18:25:21 -04:00
|
|
|
addSong('Test', 'tutorial', 'bf-pixel');
|
|
|
|
addSong('Pyro', 'weekend1', 'darnell');
|
2023-01-22 19:55:30 -05:00
|
|
|
#end
|
2021-05-06 06:54:57 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
|
2021-02-24 20:52:59 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
for (i in 0...initSonglist.length)
|
|
|
|
{
|
2023-06-09 18:25:21 -04:00
|
|
|
songs.push(new FreeplaySongData(initSonglist[i], 'tutorial', 'gf'));
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
2021-01-14 23:33:12 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
if (FlxG.sound.music != null)
|
|
|
|
{
|
2023-07-22 20:16:43 -04:00
|
|
|
if (!FlxG.sound.music.playing) FlxG.sound.playMusic(Paths.music('freakyMenu/freakyMenu'));
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
2020-11-01 14:16:22 -05:00
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
// if (StoryMenuState.weekUnlocked[2] || isDebug)
|
2023-06-09 18:25:21 -04:00
|
|
|
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 'week1', ['dad']);
|
2021-03-01 18:59:51 -05:00
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
// if (StoryMenuState.weekUnlocked[2] || isDebug)
|
2023-06-09 18:25:21 -04:00
|
|
|
addWeek(['Spookeez', 'South', 'Monster'], 'week2', ['spooky', 'spooky', 'monster']);
|
2020-11-01 14:16:22 -05:00
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
// if (StoryMenuState.weekUnlocked[3] || isDebug)
|
2023-06-09 18:25:21 -04:00
|
|
|
addWeek(['Pico', 'Philly-Nice', 'Blammed'], 'week3', ['pico']);
|
2020-12-11 06:45:00 -05:00
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
// if (StoryMenuState.weekUnlocked[4] || isDebug)
|
2023-06-09 18:25:21 -04:00
|
|
|
addWeek(['Satin-Panties', 'High', 'MILF'], 'week4', ['mom']);
|
2020-12-27 05:37:04 -05:00
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
// if (StoryMenuState.weekUnlocked[5] || isDebug)
|
2023-06-09 18:25:21 -04:00
|
|
|
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 'week5', ['parents-christmas', 'parents-christmas', 'monster-christmas']);
|
2021-01-17 04:16:02 -05:00
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
// if (StoryMenuState.weekUnlocked[6] || isDebug)
|
2023-06-09 18:25:21 -04:00
|
|
|
addWeek(['Senpai', 'Roses', 'Thorns'], 'week6', ['senpai', 'senpai', 'spirit']);
|
2021-01-24 22:42:51 -05:00
|
|
|
|
2023-06-06 17:38:31 -04:00
|
|
|
// if (StoryMenuState.weekUnlocked[7] || isDebug)
|
2023-06-09 18:25:21 -04:00
|
|
|
addWeek(['Ugh', 'Guns', 'Stress'], 'week7', ['tankman']);
|
2021-03-04 03:00:48 -05:00
|
|
|
|
2023-06-09 18:25:21 -04:00
|
|
|
addWeek(["Darnell", "lit-up", "2hot", "blazin"], 'weekend1', ['darnell']);
|
2021-09-06 14:50:04 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
// LOAD MUSIC
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
// LOAD CHARACTERS
|
2020-10-21 14:05:27 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
trace(FlxG.width);
|
|
|
|
trace(FlxG.camera.zoom);
|
|
|
|
trace(FlxG.camera.initialZoom);
|
|
|
|
trace(FlxCamera.defaultZoom);
|
2020-10-25 16:51:06 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var pinkBack:FlxSprite = new FlxSprite().loadGraphic(Paths.image('freeplay/pinkBack'));
|
|
|
|
pinkBack.color = 0xFFffd4e9; // sets it to pink!
|
|
|
|
pinkBack.x -= pinkBack.width;
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut});
|
|
|
|
add(pinkBack);
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var orangeBackShit:FlxSprite = new FlxSprite(84, FlxG.height * 0.68).makeGraphic(Std.int(pinkBack.width), 50, 0xFFffd400);
|
|
|
|
add(orangeBackShit);
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var alsoOrangeLOL:FlxSprite = new FlxSprite(0, orangeBackShit.y).makeGraphic(100, Std.int(orangeBackShit.height), 0xFFffd400);
|
|
|
|
add(alsoOrangeLOL);
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([pinkBack, orangeBackShit, alsoOrangeLOL],
|
|
|
|
{
|
|
|
|
x: -pinkBack.width,
|
|
|
|
y: pinkBack.y,
|
|
|
|
speed: 0.4,
|
|
|
|
wait: 0
|
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
FlxSpriteUtil.alphaMaskFlxSprite(orangeBackShit, pinkBack, orangeBackShit);
|
|
|
|
orangeBackShit.visible = false;
|
|
|
|
alsoOrangeLOL.visible = false;
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var grpTxtScrolls:FlxGroup = new FlxGroup();
|
|
|
|
add(grpTxtScrolls);
|
|
|
|
grpTxtScrolls.visible = false;
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var moreWays:BGScrollingText = new BGScrollingText(0, 200, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width);
|
|
|
|
moreWays.funnyColor = 0xFFfff383;
|
|
|
|
moreWays.speed = 4;
|
|
|
|
grpTxtScrolls.add(moreWays);
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([moreWays],
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
2023-03-16 01:03:45 -04:00
|
|
|
x: FlxG.width * 2,
|
|
|
|
speed: 0.4,
|
2023-03-15 21:05:15 -04:00
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var funnyScroll:BGScrollingText = new BGScrollingText(0, 250, "BOYFRIEND", FlxG.width / 2);
|
|
|
|
funnyScroll.funnyColor = 0xFFff9963;
|
|
|
|
funnyScroll.speed = -1;
|
|
|
|
grpTxtScrolls.add(funnyScroll);
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([funnyScroll],
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
2023-03-16 01:03:45 -04:00
|
|
|
x: -funnyScroll.width * 2,
|
2023-03-15 21:05:15 -04:00
|
|
|
y: funnyScroll.y,
|
2023-03-16 01:03:45 -04:00
|
|
|
speed: 0.4,
|
2023-03-15 21:05:15 -04:00
|
|
|
wait: 0
|
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var txtNuts:BGScrollingText = new BGScrollingText(0, 300, "PROTECT YO NUTS", FlxG.width / 2);
|
|
|
|
grpTxtScrolls.add(txtNuts);
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([txtNuts],
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
2023-03-16 01:03:45 -04:00
|
|
|
x: FlxG.width * 2,
|
|
|
|
speed: 0.4,
|
2023-03-15 21:05:15 -04:00
|
|
|
});
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var funnyScroll2:BGScrollingText = new BGScrollingText(0, 340, "BOYFRIEND", FlxG.width / 2);
|
|
|
|
funnyScroll2.funnyColor = 0xFFff9963;
|
|
|
|
funnyScroll2.speed = -1.2;
|
|
|
|
grpTxtScrolls.add(funnyScroll2);
|
2021-10-21 23:08:48 -04:00
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([funnyScroll2],
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
2023-03-16 01:03:45 -04:00
|
|
|
x: -funnyScroll2.width * 2,
|
|
|
|
speed: 0.5,
|
2023-03-15 21:05:15 -04:00
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var moreWays2:BGScrollingText = new BGScrollingText(0, 400, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width);
|
|
|
|
moreWays2.funnyColor = 0xFFfff383;
|
|
|
|
moreWays2.speed = 4.4;
|
|
|
|
grpTxtScrolls.add(moreWays2);
|
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([moreWays2],
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
2023-03-16 01:03:45 -04:00
|
|
|
x: FlxG.width * 2,
|
|
|
|
speed: 0.4
|
2023-03-15 21:05:15 -04:00
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var funnyScroll3:BGScrollingText = new BGScrollingText(0, orangeBackShit.y, "BOYFRIEND", FlxG.width / 2);
|
|
|
|
funnyScroll3.funnyColor = 0xFFff9963;
|
|
|
|
funnyScroll3.speed = -0.8;
|
|
|
|
grpTxtScrolls.add(funnyScroll3);
|
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([funnyScroll3],
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
2023-03-16 01:03:45 -04:00
|
|
|
x: -funnyScroll3.width * 2,
|
|
|
|
speed: 0.3
|
2023-03-15 21:05:15 -04:00
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
dj = new DJBoyfriend(0, -100);
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([dj],
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
|
|
|
x: -dj.width * 1.6,
|
2023-03-16 01:03:45 -04:00
|
|
|
speed: 0.5
|
2023-03-15 21:05:15 -04:00
|
|
|
});
|
2023-01-22 19:55:30 -05:00
|
|
|
add(dj);
|
|
|
|
|
|
|
|
var bgDad:FlxSprite = new FlxSprite(pinkBack.width * 0.75, 0).loadGraphic(Paths.image('freeplay/freeplayBGdad'));
|
|
|
|
bgDad.setGraphicSize(0, FlxG.height);
|
|
|
|
bgDad.updateHitbox();
|
|
|
|
bgDad.shader = new AngleMask();
|
|
|
|
bgDad.visible = false;
|
|
|
|
|
|
|
|
var blackOverlayBullshitLOLXD:FlxSprite = new FlxSprite(FlxG.width).makeGraphic(Std.int(bgDad.width), Std.int(bgDad.height), FlxColor.BLACK);
|
|
|
|
add(blackOverlayBullshitLOLXD); // used to mask the text lol!
|
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([blackOverlayBullshitLOLXD, bgDad],
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
|
|
|
x: FlxG.width * 1.5,
|
|
|
|
y: bgDad.height,
|
2023-03-16 00:17:52 -04:00
|
|
|
speed: 0.4,
|
2023-03-15 21:05:15 -04:00
|
|
|
wait: 0
|
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
add(bgDad);
|
|
|
|
FlxTween.tween(blackOverlayBullshitLOLXD, {x: pinkBack.width * 0.75}, 1, {ease: FlxEase.quintOut});
|
|
|
|
|
|
|
|
blackOverlayBullshitLOLXD.shader = bgDad.shader;
|
|
|
|
|
|
|
|
grpSongs = new FlxTypedGroup<Alphabet>();
|
|
|
|
add(grpSongs);
|
|
|
|
|
|
|
|
grpCapsules = new FlxTypedGroup<SongMenuItem>();
|
|
|
|
add(grpCapsules);
|
|
|
|
|
|
|
|
grpDifficulties = new FlxSpriteGroup(-300, 80);
|
|
|
|
add(grpDifficulties);
|
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([grpDifficulties],
|
|
|
|
{
|
|
|
|
x: -300,
|
|
|
|
speed: 0.25,
|
|
|
|
wait: 0
|
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayEasy')));
|
|
|
|
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayNorm')));
|
|
|
|
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayHard')));
|
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
grpDifficulties.group.forEach(function(spr) {
|
2023-01-22 19:55:30 -05:00
|
|
|
spr.visible = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
grpDifficulties.group.members[curDifficulty].visible = true;
|
|
|
|
|
2023-08-09 19:34:19 -04:00
|
|
|
var albumArt:FlxAtlasSprite = new FlxAtlasSprite(640, 360, Paths.animateAtlas("freeplay/albumRoll"));
|
|
|
|
albumArt.visible = false;
|
|
|
|
add(albumArt);
|
|
|
|
|
|
|
|
exitMovers.set([albumArt],
|
|
|
|
{
|
|
|
|
x: FlxG.width,
|
|
|
|
speed: 0.4,
|
|
|
|
wait: 0
|
|
|
|
});
|
|
|
|
|
|
|
|
var albumTitle:FlxSprite = new FlxSprite(947, 491).loadGraphic(Paths.image('freeplay/albumTitle-fnfvol1'));
|
|
|
|
var albumArtist:FlxSprite = new FlxSprite(1010, 607).loadGraphic(Paths.image('freeplay/albumArtist-kawaisprite'));
|
|
|
|
|
|
|
|
albumTitle.visible = false;
|
|
|
|
albumArtist.visible = false;
|
|
|
|
|
|
|
|
exitMovers.set([albumTitle],
|
|
|
|
{
|
|
|
|
x: FlxG.width,
|
|
|
|
speed: 0.2,
|
|
|
|
wait: 0.1
|
|
|
|
});
|
|
|
|
|
|
|
|
exitMovers.set([albumArtist],
|
|
|
|
{
|
|
|
|
x: FlxG.width * 1.1,
|
|
|
|
speed: 0.2,
|
|
|
|
wait: 0.2
|
|
|
|
});
|
|
|
|
|
|
|
|
add(albumTitle);
|
|
|
|
add(albumArtist);
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var overhangStuff:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 64, FlxColor.BLACK);
|
|
|
|
overhangStuff.y -= overhangStuff.height;
|
|
|
|
add(overhangStuff);
|
|
|
|
FlxTween.tween(overhangStuff, {y: 0}, 0.3, {ease: FlxEase.quartOut});
|
|
|
|
|
|
|
|
var fnfFreeplay:FlxText = new FlxText(0, 12, 0, "FREEPLAY", 48);
|
|
|
|
fnfFreeplay.font = "VCR OSD Mono";
|
|
|
|
fnfFreeplay.visible = false;
|
2023-03-15 21:05:15 -04:00
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([overhangStuff, fnfFreeplay],
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
2023-03-16 00:17:52 -04:00
|
|
|
y: -overhangStuff.height,
|
2023-03-15 21:05:15 -04:00
|
|
|
x: 0,
|
|
|
|
speed: 0.2,
|
|
|
|
wait: 0
|
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
var sillyStroke = new StrokeShader(0xFFFFFFFF, 2, 2);
|
|
|
|
fnfFreeplay.shader = sillyStroke;
|
|
|
|
add(fnfFreeplay);
|
|
|
|
|
|
|
|
var fnfHighscoreSpr:FlxSprite = new FlxSprite(890, 70);
|
|
|
|
fnfHighscoreSpr.frames = Paths.getSparrowAtlas('freeplay/highscore');
|
|
|
|
fnfHighscoreSpr.animation.addByPrefix("highscore", "highscore", 24, false);
|
|
|
|
fnfHighscoreSpr.visible = false;
|
|
|
|
fnfHighscoreSpr.setGraphicSize(0, Std.int(fnfHighscoreSpr.height * 1));
|
|
|
|
fnfHighscoreSpr.updateHitbox();
|
|
|
|
add(fnfHighscoreSpr);
|
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
new FlxTimer().start(FlxG.random.float(12, 50), function(tmr) {
|
2023-01-22 19:55:30 -05:00
|
|
|
fnfHighscoreSpr.animation.play("highscore");
|
|
|
|
tmr.time = FlxG.random.float(20, 60);
|
|
|
|
}, 0);
|
|
|
|
|
|
|
|
fp = new FreeplayScore(460, 60, 100);
|
|
|
|
fp.visible = false;
|
|
|
|
add(fp);
|
|
|
|
|
|
|
|
txtCompletion = new FlxText(1200, 77, 0, "0", 32);
|
|
|
|
txtCompletion.font = "VCR OSD Mono";
|
|
|
|
txtCompletion.visible = false;
|
|
|
|
add(txtCompletion);
|
|
|
|
|
2023-08-09 16:15:34 -04:00
|
|
|
var letterSort:LetterSort = new LetterSort(400, 75);
|
|
|
|
add(letterSort);
|
|
|
|
letterSort.visible = false;
|
|
|
|
|
|
|
|
exitMovers.set([letterSort],
|
|
|
|
{
|
|
|
|
y: -100,
|
|
|
|
speed: 0.3
|
|
|
|
});
|
|
|
|
|
|
|
|
letterSort.changeSelectionCallback = (str) -> {
|
|
|
|
switch (str)
|
|
|
|
{
|
|
|
|
case "fav":
|
|
|
|
generateSongList({filterType: FAVORITE}, true);
|
|
|
|
case "ALL":
|
2023-08-09 19:34:19 -04:00
|
|
|
generateSongList(null, true);
|
2023-08-09 16:15:34 -04:00
|
|
|
default:
|
|
|
|
generateSongList({filterType: REGEXP, filterData: str}, true);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([fp, txtCompletion, fnfHighscoreSpr],
|
|
|
|
{
|
|
|
|
x: FlxG.width,
|
|
|
|
speed: 0.3
|
|
|
|
});
|
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
dj.onIntroDone.add(function() {
|
2023-08-09 19:34:19 -04:00
|
|
|
// when boyfriend hits dat shiii
|
|
|
|
//
|
|
|
|
albumArt.visible = true;
|
|
|
|
albumArt.anim.play("");
|
|
|
|
albumArt.anim.onComplete = function() {
|
|
|
|
albumArt.anim.pause();
|
|
|
|
};
|
|
|
|
|
|
|
|
new FlxTimer().start(1, function(_) {
|
|
|
|
albumTitle.visible = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
new FlxTimer().start(35 / 24, function(_) {
|
|
|
|
albumArtist.visible = true;
|
|
|
|
});
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut});
|
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
var diffSelLeft = new DifficultySelector(20, grpDifficulties.y - 10, false, controls);
|
|
|
|
var diffSelRight = new DifficultySelector(325, grpDifficulties.y - 10, true, controls);
|
|
|
|
|
|
|
|
add(diffSelLeft);
|
|
|
|
add(diffSelRight);
|
|
|
|
|
2023-08-09 16:15:34 -04:00
|
|
|
letterSort.visible = true;
|
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
exitMovers.set([diffSelLeft, diffSelRight],
|
|
|
|
{
|
|
|
|
x: -diffSelLeft.width * 2,
|
|
|
|
speed: 0.26
|
|
|
|
});
|
2023-01-22 19:55:30 -05:00
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
new FlxTimer().start(1 / 24, function(handShit) {
|
2023-01-22 19:55:30 -05:00
|
|
|
fnfHighscoreSpr.visible = true;
|
|
|
|
fnfFreeplay.visible = true;
|
|
|
|
fp.visible = true;
|
|
|
|
fp.updateScore(0);
|
|
|
|
|
|
|
|
txtCompletion.visible = true;
|
|
|
|
intendedCompletion = 0;
|
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
new FlxTimer().start(1.5 / 24, function(bold) {
|
2023-01-22 19:55:30 -05:00
|
|
|
sillyStroke.width = 0;
|
|
|
|
sillyStroke.height = 0;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
pinkBack.color = 0xFFffd863;
|
|
|
|
bgDad.visible = true;
|
|
|
|
orangeBackShit.visible = true;
|
|
|
|
alsoOrangeLOL.visible = true;
|
|
|
|
grpTxtScrolls.visible = true;
|
|
|
|
});
|
|
|
|
|
2023-08-09 02:47:22 -04:00
|
|
|
generateSongList(null, false);
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
// FlxG.sound.playMusic(Paths.music('title'), 0);
|
|
|
|
// FlxG.sound.music.fadeIn(2, 0, 0.8);
|
|
|
|
// selector = new FlxText();
|
|
|
|
|
|
|
|
// selector.size = 40;
|
|
|
|
// selector.text = ">";
|
|
|
|
// add(selector);
|
|
|
|
|
|
|
|
var swag:Alphabet = new Alphabet(1, 0, "swag");
|
|
|
|
|
|
|
|
// JUST DOIN THIS SHIT FOR TESTING!!!
|
2023-06-08 16:30:45 -04:00
|
|
|
/*
|
2023-01-22 19:55:30 -05:00
|
|
|
var md:String = Markdown.markdownToHtml(Assets.getText('CHANGELOG.md'));
|
|
|
|
|
|
|
|
var texFel:TextField = new TextField();
|
|
|
|
texFel.width = FlxG.width;
|
|
|
|
texFel.height = FlxG.height;
|
|
|
|
// texFel.
|
|
|
|
texFel.htmlText = md;
|
|
|
|
|
|
|
|
FlxG.stage.addChild(texFel);
|
|
|
|
|
|
|
|
trace(md);
|
|
|
|
*/
|
|
|
|
|
|
|
|
var funnyCam = new FlxCamera(0, 0, FlxG.width, FlxG.height);
|
|
|
|
funnyCam.bgColor = FlxColor.TRANSPARENT;
|
|
|
|
FlxG.cameras.add(funnyCam);
|
|
|
|
|
|
|
|
typing = new FlxInputText(100, 100);
|
2023-03-16 01:03:45 -04:00
|
|
|
// add(typing);
|
2023-01-22 19:55:30 -05:00
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
typing.callback = function(txt, action) {
|
2023-01-22 19:55:30 -05:00
|
|
|
// generateSongList(new EReg(txt.trim(), "ig"));
|
|
|
|
trace(action);
|
|
|
|
};
|
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
forEach(function(bs) {
|
2023-01-22 19:55:30 -05:00
|
|
|
bs.cameras = [funnyCam];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-08-28 15:03:29 -04:00
|
|
|
public function generateSongList(?filterStuff:SongFilter, force:Bool = false)
|
2023-01-22 19:55:30 -05:00
|
|
|
{
|
2023-08-06 16:24:34 -04:00
|
|
|
curSelected = 1;
|
2023-01-22 19:55:30 -05:00
|
|
|
|
2023-08-09 02:47:22 -04:00
|
|
|
for (cap in grpCapsules.members)
|
|
|
|
cap.kill();
|
|
|
|
|
|
|
|
// grpCapsules.clear();
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
// var regexp:EReg = regexp;
|
2023-06-09 18:25:21 -04:00
|
|
|
var tempSongs:Array<FreeplaySongData> = songs;
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
if (filterStuff != null)
|
|
|
|
{
|
|
|
|
switch (filterStuff.filterType)
|
|
|
|
{
|
2023-08-07 16:01:22 -04:00
|
|
|
case REGEXP:
|
|
|
|
// filterStuff.filterData has a string with the first letter of the sorting range, and the second one
|
|
|
|
// this creates a filter to return all the songs that start with a letter between those two
|
|
|
|
var filterRegexp = new EReg("^[" + filterStuff.filterData + "].*", "i");
|
|
|
|
tempSongs = tempSongs.filter(str -> {
|
|
|
|
return filterRegexp.match(str.songName);
|
|
|
|
});
|
2023-01-22 19:55:30 -05:00
|
|
|
case STARTSWITH:
|
2023-03-15 21:05:15 -04:00
|
|
|
tempSongs = tempSongs.filter(str -> {
|
2023-01-22 19:55:30 -05:00
|
|
|
return str.songName.toLowerCase().startsWith(filterStuff.filterData);
|
|
|
|
});
|
|
|
|
case ALL:
|
|
|
|
// no filter!
|
|
|
|
case FAVORITE:
|
2023-03-15 21:05:15 -04:00
|
|
|
tempSongs = tempSongs.filter(str -> {
|
2023-01-22 19:55:30 -05:00
|
|
|
return str.isFav;
|
|
|
|
});
|
|
|
|
default:
|
|
|
|
// return all on default
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-09 02:47:22 -04:00
|
|
|
var randomCapsule:SongMenuItem = grpCapsules.recycle(SongMenuItem);
|
|
|
|
randomCapsule.init(FlxG.width, 0, "Random");
|
2023-08-06 16:24:34 -04:00
|
|
|
randomCapsule.onConfirm = function() {
|
|
|
|
trace("RANDOM SELECTED");
|
|
|
|
};
|
|
|
|
randomCapsule.y = randomCapsule.intendedY(0) + 10;
|
|
|
|
randomCapsule.targetPos.x = randomCapsule.x;
|
|
|
|
randomCapsule.alpha = 0.5;
|
|
|
|
randomCapsule.songText.visible = false;
|
|
|
|
randomCapsule.favIcon.visible = false;
|
|
|
|
randomCapsule.initJumpIn(0, force);
|
|
|
|
grpCapsules.add(randomCapsule);
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
for (i in 0...tempSongs.length)
|
|
|
|
{
|
2023-08-09 02:47:22 -04:00
|
|
|
var funnyMenu:SongMenuItem = grpCapsules.recycle(SongMenuItem);
|
|
|
|
funnyMenu.init(FlxG.width, 0, tempSongs[i].songName);
|
2023-08-08 14:35:07 -04:00
|
|
|
if (tempSongs[i].songCharacter != null) funnyMenu.setCharacter(tempSongs[i].songCharacter);
|
2023-08-06 16:24:34 -04:00
|
|
|
funnyMenu.onConfirm = capsuleOnConfirmDefault;
|
2023-08-04 17:10:27 -04:00
|
|
|
funnyMenu.y = funnyMenu.intendedY(i + 1) + 10;
|
2023-01-22 19:55:30 -05:00
|
|
|
funnyMenu.targetPos.x = funnyMenu.x;
|
|
|
|
funnyMenu.ID = i;
|
|
|
|
funnyMenu.alpha = 0.5;
|
|
|
|
funnyMenu.songText.visible = false;
|
|
|
|
funnyMenu.favIcon.visible = tempSongs[i].isFav;
|
|
|
|
|
|
|
|
// fp.updateScore(0);
|
|
|
|
|
2023-08-09 02:47:22 -04:00
|
|
|
if (i < 8) funnyMenu.initJumpIn(Math.min(i, 4), force);
|
|
|
|
else
|
|
|
|
funnyMenu.forcePosition();
|
2023-01-22 19:55:30 -05:00
|
|
|
|
2023-08-09 02:47:22 -04:00
|
|
|
grpCapsules.add(funnyMenu);
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
changeSelection();
|
|
|
|
changeDiff();
|
|
|
|
}
|
|
|
|
|
2023-06-09 18:25:21 -04:00
|
|
|
public function addSong(songName:String, levelId:String, songCharacter:String)
|
2023-01-22 19:55:30 -05:00
|
|
|
{
|
2023-06-09 18:25:21 -04:00
|
|
|
songs.push(new FreeplaySongData(songName, levelId, songCharacter));
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
|
2023-06-09 18:25:21 -04:00
|
|
|
public function addWeek(songs:Array<String>, levelId:String, ?songCharacters:Array<String>)
|
2023-01-22 19:55:30 -05:00
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
if (songCharacters == null) songCharacters = ['bf'];
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
var num:Int = 0;
|
|
|
|
for (song in songs)
|
|
|
|
{
|
2023-06-09 18:25:21 -04:00
|
|
|
addSong(song, levelId, songCharacters[num]);
|
2023-01-22 19:55:30 -05:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
if (songCharacters.length != 1) num++;
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var touchY:Float = 0;
|
|
|
|
var touchX:Float = 0;
|
|
|
|
var dxTouch:Float = 0;
|
|
|
|
var dyTouch:Float = 0;
|
|
|
|
var velTouch:Float = 0;
|
|
|
|
|
|
|
|
var veloctiyLoopShit:Float = 0;
|
|
|
|
var touchTimer:Float = 0;
|
|
|
|
|
|
|
|
var initTouchPos:FlxPoint = new FlxPoint();
|
|
|
|
|
|
|
|
var spamTimer:Float = 0;
|
|
|
|
var spamming:Bool = false;
|
|
|
|
|
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
|
|
|
super.update(elapsed);
|
|
|
|
|
|
|
|
if (FlxG.keys.justPressed.F)
|
|
|
|
{
|
|
|
|
var realShit = curSelected;
|
|
|
|
songs[curSelected].isFav = !songs[curSelected].isFav;
|
|
|
|
if (songs[curSelected].isFav)
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
FlxTween.tween(grpCapsules.members[realShit], {angle: 360}, 0.4,
|
2023-01-22 19:55:30 -05:00
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
ease: FlxEase.elasticOut,
|
2023-03-15 21:05:15 -04:00
|
|
|
onComplete: _ -> {
|
2023-01-22 22:25:45 -05:00
|
|
|
grpCapsules.members[realShit].favIcon.visible = true;
|
|
|
|
grpCapsules.members[realShit].favIcon.animation.play("fav");
|
|
|
|
}
|
|
|
|
});
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
grpCapsules.members[realShit].favIcon.animation.play('fav', false, true);
|
2023-03-15 21:05:15 -04:00
|
|
|
new FlxTimer().start((1 / 24) * 14, _ -> {
|
2023-01-22 19:55:30 -05:00
|
|
|
grpCapsules.members[realShit].favIcon.visible = false;
|
|
|
|
});
|
2023-03-15 21:05:15 -04:00
|
|
|
new FlxTimer().start((1 / 24) * 24, _ -> {
|
2023-01-22 19:55:30 -05:00
|
|
|
FlxTween.tween(grpCapsules.members[realShit], {angle: 0}, 0.4, {ease: FlxEase.elasticOut});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
if (FlxG.keys.justPressed.T) typing.hasFocus = true;
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
if (FlxG.sound.music != null)
|
|
|
|
{
|
|
|
|
if (FlxG.sound.music.volume < 0.7)
|
|
|
|
{
|
|
|
|
FlxG.sound.music.volume += 0.5 * elapsed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.2);
|
|
|
|
lerpCompletion = CoolUtil.coolLerp(lerpCompletion, intendedCompletion, 0.9);
|
|
|
|
|
|
|
|
fp.updateScore(Std.int(lerpScore));
|
|
|
|
|
|
|
|
txtCompletion.text = Math.floor(lerpCompletion * 100) + "%";
|
2023-03-15 21:05:15 -04:00
|
|
|
// trace(Highscore.getCompletion(songs[curSelected].songName, curDifficulty));
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
// trace(intendedScore);
|
|
|
|
// trace(lerpScore);
|
|
|
|
// Highscore.getAllScores();
|
|
|
|
|
|
|
|
var upP = controls.UI_UP_P;
|
|
|
|
var downP = controls.UI_DOWN_P;
|
|
|
|
var accepted = controls.ACCEPT;
|
|
|
|
|
|
|
|
if (FlxG.onMobile)
|
|
|
|
{
|
|
|
|
for (touch in FlxG.touches.list)
|
|
|
|
{
|
|
|
|
if (touch.justPressed)
|
|
|
|
{
|
|
|
|
initTouchPos.set(touch.screenX, touch.screenY);
|
|
|
|
}
|
|
|
|
if (touch.pressed)
|
|
|
|
{
|
|
|
|
var dx = initTouchPos.x - touch.screenX;
|
|
|
|
var dy = initTouchPos.y - touch.screenY;
|
|
|
|
|
|
|
|
var angle = Math.atan2(dy, dx);
|
|
|
|
var length = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
|
|
|
|
FlxG.watch.addQuick("LENGTH", length);
|
|
|
|
FlxG.watch.addQuick("ANGLE", Math.round(FlxAngle.asDegrees(angle)));
|
2023-03-15 21:05:15 -04:00
|
|
|
// trace("ANGLE", Math.round(FlxAngle.asDegrees(angle)));
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* switch (inputID)
|
|
|
|
{
|
|
|
|
case FlxObject.UP:
|
|
|
|
return
|
|
|
|
case FlxObject.DOWN:
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FlxG.touches.getFirst() != null)
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
if (touchTimer >= 1.5) accepted = true;
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
touchTimer += elapsed;
|
|
|
|
var touch:FlxTouch = FlxG.touches.getFirst();
|
|
|
|
|
|
|
|
velTouch = Math.abs((touch.screenY - dyTouch)) / 50;
|
|
|
|
|
|
|
|
dyTouch = touch.screenY - touchY;
|
|
|
|
dxTouch = touch.screenX - touchX;
|
|
|
|
|
|
|
|
if (touch.justPressed)
|
|
|
|
{
|
|
|
|
touchY = touch.screenY;
|
|
|
|
dyTouch = 0;
|
|
|
|
velTouch = 0;
|
|
|
|
|
|
|
|
touchX = touch.screenX;
|
|
|
|
dxTouch = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Math.abs(dxTouch) >= 100)
|
|
|
|
{
|
|
|
|
touchX = touch.screenX;
|
2023-01-22 22:25:45 -05:00
|
|
|
if (dxTouch != 0) dxTouch < 0 ? changeDiff(1) : changeDiff(-1);
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Math.abs(dyTouch) >= 100)
|
|
|
|
{
|
|
|
|
touchY = touch.screenY;
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
if (dyTouch != 0) dyTouch < 0 ? changeSelection(1) : changeSelection(-1);
|
2023-01-22 19:55:30 -05:00
|
|
|
// changeSelection(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
touchTimer = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if mobile
|
|
|
|
for (touch in FlxG.touches.list)
|
|
|
|
{
|
|
|
|
if (touch.justPressed)
|
|
|
|
{
|
|
|
|
// accepted = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#end
|
|
|
|
|
|
|
|
if (controls.UI_UP || controls.UI_DOWN)
|
|
|
|
{
|
|
|
|
spamTimer += elapsed;
|
|
|
|
|
|
|
|
if (spamming)
|
|
|
|
{
|
|
|
|
if (spamTimer >= 0.07)
|
|
|
|
{
|
|
|
|
spamTimer = 0;
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
if (controls.UI_UP) changeSelection(-1);
|
2023-01-22 19:55:30 -05:00
|
|
|
else
|
|
|
|
changeSelection(1);
|
|
|
|
}
|
|
|
|
}
|
2023-01-22 22:25:45 -05:00
|
|
|
else if (spamTimer >= 0.9) spamming = true;
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
spamming = false;
|
|
|
|
spamTimer = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (upP)
|
|
|
|
{
|
|
|
|
dj.resetAFKTimer();
|
|
|
|
changeSelection(-1);
|
|
|
|
}
|
|
|
|
if (downP)
|
|
|
|
{
|
|
|
|
dj.resetAFKTimer();
|
|
|
|
changeSelection(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FlxG.mouse.wheel != 0)
|
|
|
|
{
|
|
|
|
dj.resetAFKTimer();
|
|
|
|
changeSelection(-Math.round(FlxG.mouse.wheel / 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (controls.UI_LEFT_P)
|
|
|
|
{
|
|
|
|
dj.resetAFKTimer();
|
|
|
|
changeDiff(-1);
|
|
|
|
}
|
|
|
|
if (controls.UI_RIGHT_P)
|
|
|
|
{
|
|
|
|
dj.resetAFKTimer();
|
|
|
|
changeDiff(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (controls.BACK && !typing.hasFocus)
|
|
|
|
{
|
2023-03-16 22:02:56 -04:00
|
|
|
FlxTween.globalManager.clear();
|
|
|
|
FlxTimer.globalManager.clear();
|
|
|
|
dj.onIntroDone.removeAll();
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
FlxG.sound.play(Paths.sound('cancelMenu'));
|
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
// FlxTween.tween(dj, {x: -dj.width}, 0.2, {ease: FlxEase.quartOut});
|
|
|
|
|
|
|
|
var longestTimer:Float = 0;
|
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
for (grpSpr in exitMovers.keys())
|
2023-03-15 21:05:15 -04:00
|
|
|
{
|
2023-03-16 00:17:52 -04:00
|
|
|
var moveData:MoveData = exitMovers.get(grpSpr);
|
|
|
|
|
|
|
|
for (spr in grpSpr)
|
|
|
|
{
|
|
|
|
var funnyMoveShit:MoveData = moveData;
|
|
|
|
|
|
|
|
if (moveData.x == null) funnyMoveShit.x = spr.x;
|
|
|
|
if (moveData.y == null) funnyMoveShit.y = spr.y;
|
|
|
|
if (moveData.speed == null) funnyMoveShit.speed = 0.2;
|
|
|
|
if (moveData.wait == null) funnyMoveShit.wait = 0;
|
2023-03-15 21:05:15 -04:00
|
|
|
|
2023-03-16 00:17:52 -04:00
|
|
|
FlxTween.tween(spr, {x: funnyMoveShit.x, y: funnyMoveShit.y}, funnyMoveShit.speed, {ease: FlxEase.expoIn});
|
|
|
|
|
|
|
|
longestTimer = Math.max(longestTimer, funnyMoveShit.speed + funnyMoveShit.wait);
|
|
|
|
}
|
2023-03-15 21:05:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
for (caps in grpCapsules.members)
|
|
|
|
{
|
|
|
|
caps.doJumpIn = false;
|
|
|
|
caps.doLerp = false;
|
|
|
|
caps.doJumpOut = true;
|
|
|
|
}
|
|
|
|
|
2023-03-16 00:55:25 -04:00
|
|
|
if (Type.getClass(FlxG.state) == MainMenuState)
|
|
|
|
{
|
|
|
|
FlxG.state.persistentUpdate = true;
|
|
|
|
FlxG.state.persistentDraw = true;
|
|
|
|
}
|
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
new FlxTimer().start(longestTimer, (_) -> {
|
|
|
|
FlxTransitionableState.skipNextTransIn = true;
|
|
|
|
FlxTransitionableState.skipNextTransOut = true;
|
2023-03-16 00:17:52 -04:00
|
|
|
if (Type.getClass(FlxG.state) == MainMenuState)
|
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FlxG.switchState(new MainMenuState());
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// close();
|
2023-03-15 21:05:15 -04:00
|
|
|
});
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (accepted)
|
|
|
|
{
|
|
|
|
// if (Assets.exists())
|
|
|
|
|
2023-08-06 16:24:34 -04:00
|
|
|
grpCapsules.members[curSelected].onConfirm();
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-31 14:08:48 -04:00
|
|
|
@:haxe.warning("-WDeprecated")
|
2023-06-02 15:35:01 -04:00
|
|
|
override function switchTo(nextState:FlxState):Bool
|
2023-01-22 19:55:30 -05:00
|
|
|
{
|
|
|
|
clearDaCache(songs[curSelected].songName);
|
2023-06-02 15:35:01 -04:00
|
|
|
return super.switchTo(nextState);
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function changeDiff(change:Int = 0)
|
|
|
|
{
|
|
|
|
touchTimer = 0;
|
|
|
|
|
|
|
|
curDifficulty += change;
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
if (curDifficulty < 0) curDifficulty = 2;
|
|
|
|
if (curDifficulty > 2) curDifficulty = 0;
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
// intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
|
|
|
|
intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
|
|
|
|
intendedCompletion = Highscore.getCompletion(songs[curSelected].songName, curDifficulty);
|
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
grpDifficulties.group.forEach(function(spr) {
|
2023-01-22 19:55:30 -05:00
|
|
|
spr.visible = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
var curShit:FlxSprite = grpDifficulties.group.members[curDifficulty];
|
|
|
|
|
|
|
|
curShit.visible = true;
|
|
|
|
curShit.offset.y += 5;
|
|
|
|
curShit.alpha = 0.5;
|
2023-03-15 21:05:15 -04:00
|
|
|
new FlxTimer().start(1 / 24, function(swag) {
|
2023-01-22 19:55:30 -05:00
|
|
|
curShit.alpha = 1;
|
|
|
|
curShit.updateHitbox();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clears the cache of songs, frees up memory, they' ll have to be loaded in later tho function clearDaCache(actualSongTho:String)
|
|
|
|
function clearDaCache(actualSongTho:String)
|
|
|
|
{
|
|
|
|
for (song in songs)
|
|
|
|
{
|
|
|
|
if (song.songName != actualSongTho)
|
|
|
|
{
|
|
|
|
trace('trying to remove: ' + song.songName);
|
|
|
|
// openfl.Assets.cache.clear(Paths.inst(song.songName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-06 16:24:34 -04:00
|
|
|
function capsuleOnConfirmDefault():Void
|
|
|
|
{
|
|
|
|
var poop:String = songs[curSelected].songName.toLowerCase();
|
|
|
|
|
|
|
|
// does not work properly, always just accidentally sets it to normal anyways!
|
|
|
|
/* if (!Assets.exists(Paths.json(songs[curSelected].songName + '/' + poop)))
|
|
|
|
{
|
|
|
|
// defaults to normal if HARD / EASY doesn't exist
|
|
|
|
// does not account if NORMAL doesn't exist!
|
|
|
|
FlxG.log.warn("CURRENT DIFFICULTY IS NOT CHARTED, DEFAULTING TO NORMAL!");
|
|
|
|
poop = Highscore.formatSong(songs[curSelected].songName.toLowerCase(), 1);
|
|
|
|
curDifficulty = 1;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
PlayStatePlaylist.isStoryMode = false;
|
|
|
|
var targetSong:Song = SongDataParser.fetchSong(songs[curSelected].songName.toLowerCase());
|
|
|
|
var targetDifficulty:String = switch (curDifficulty)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
'easy';
|
|
|
|
case 1:
|
|
|
|
'normal';
|
|
|
|
case 2:
|
|
|
|
'hard';
|
|
|
|
default: 'normal';
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: Implement additional difficulties into the interface properly.
|
|
|
|
if (FlxG.keys.pressed.E)
|
|
|
|
{
|
|
|
|
targetDifficulty = 'erect';
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Implement Pico into the interface properly.
|
|
|
|
var targetCharacter:String = 'bf';
|
|
|
|
if (FlxG.keys.pressed.P)
|
|
|
|
{
|
|
|
|
targetCharacter = 'pico';
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayStatePlaylist.campaignId = songs[curSelected].levelId;
|
|
|
|
|
|
|
|
// Visual and audio effects.
|
|
|
|
FlxG.sound.play(Paths.sound('confirmMenu'));
|
|
|
|
dj.confirm();
|
|
|
|
|
|
|
|
new FlxTimer().start(1, function(tmr:FlxTimer) {
|
|
|
|
LoadingState.loadAndSwitchState(new PlayState(
|
|
|
|
{
|
|
|
|
targetSong: targetSong,
|
|
|
|
targetDifficulty: targetDifficulty,
|
|
|
|
targetCharacter: targetCharacter,
|
|
|
|
}), true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
function changeSelection(change:Int = 0)
|
|
|
|
{
|
|
|
|
// fp.updateScore(12345);
|
|
|
|
|
|
|
|
// NGio.logEvent('Fresh');
|
|
|
|
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
|
2023-08-13 22:12:08 -04:00
|
|
|
// FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName));
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
curSelected += change;
|
|
|
|
|
2023-08-09 03:03:58 -04:00
|
|
|
if (curSelected < 0) curSelected = grpCapsules.countLiving() - 1;
|
|
|
|
if (curSelected >= grpCapsules.countLiving()) curSelected = 0;
|
2023-01-22 19:55:30 -05:00
|
|
|
|
|
|
|
// selector.y = (70 * curSelected) + 30;
|
|
|
|
|
|
|
|
// intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
|
2023-08-09 03:03:58 -04:00
|
|
|
|
|
|
|
if (songs[curSelected] != null)
|
|
|
|
{
|
|
|
|
intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
|
|
|
|
intendedCompletion = Highscore.getCompletion(songs[curSelected].songName, curDifficulty);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
intendedScore = 0;
|
|
|
|
intendedCompletion = 0;
|
|
|
|
}
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
// lerpScore = 0;
|
|
|
|
|
|
|
|
#if PRELOAD_ALL
|
|
|
|
// FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0);
|
|
|
|
#end
|
|
|
|
|
|
|
|
for (index => capsule in grpCapsules.members)
|
|
|
|
{
|
2023-08-04 15:59:17 -04:00
|
|
|
index += 1;
|
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
capsule.selected = false;
|
|
|
|
|
2023-08-04 17:10:27 -04:00
|
|
|
capsule.targetPos.y = capsule.intendedY(index - curSelected);
|
2023-01-22 19:55:30 -05:00
|
|
|
capsule.targetPos.x = 270 + (60 * (Math.sin(index - curSelected)));
|
|
|
|
// capsule.targetPos.x = 320 + (40 * (index - curSelected));
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
if (index < curSelected) capsule.targetPos.y -= 100; // another 100 for good measure
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
|
|
|
|
2023-08-13 22:12:08 -04:00
|
|
|
if (grpCapsules.countLiving() > 0)
|
|
|
|
{
|
|
|
|
if (curSelected == 0)
|
|
|
|
{
|
|
|
|
FlxG.sound.playMusic(Paths.music('freeplay/freeplayRandom'), 0);
|
|
|
|
FlxG.sound.music.fadeIn(2, 0, 0.8);
|
|
|
|
}
|
|
|
|
grpCapsules.members[curSelected].selected = true;
|
|
|
|
}
|
2023-01-22 19:55:30 -05:00
|
|
|
}
|
2021-12-07 19:29:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
class DifficultySelector extends FlxSprite
|
|
|
|
{
|
2023-01-22 19:55:30 -05:00
|
|
|
var controls:Controls;
|
|
|
|
var whiteShader:PureColor;
|
2021-12-07 19:29:26 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
public function new(x:Float, y:Float, flipped:Bool, controls:Controls)
|
|
|
|
{
|
|
|
|
super(x, y);
|
2021-12-07 19:29:26 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
this.controls = controls;
|
2021-12-07 19:29:26 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
frames = Paths.getSparrowAtlas('freeplay/freeplaySelector');
|
|
|
|
animation.addByPrefix('shine', "arrow pointer loop", 24);
|
|
|
|
animation.play('shine');
|
2021-12-07 19:29:26 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
whiteShader = new PureColor(FlxColor.WHITE);
|
2021-12-07 22:34:01 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
shader = whiteShader;
|
2021-12-07 22:34:01 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
flipX = flipped;
|
|
|
|
}
|
2021-04-08 17:29:31 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
if (flipX && controls.UI_RIGHT_P) moveShitDown();
|
|
|
|
if (!flipX && controls.UI_LEFT_P) moveShitDown();
|
2021-12-07 19:29:26 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
super.update(elapsed);
|
|
|
|
}
|
2021-12-07 19:29:26 -05:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
function moveShitDown()
|
|
|
|
{
|
|
|
|
offset.y -= 5;
|
2021-04-08 17:29:31 -04:00
|
|
|
|
2023-01-22 19:55:30 -05:00
|
|
|
whiteShader.colorSet = true;
|
2021-12-07 22:34:01 -05:00
|
|
|
|
2023-08-06 22:20:18 -04:00
|
|
|
scale.x = scale.y = 0.5;
|
|
|
|
|
2023-03-15 21:05:15 -04:00
|
|
|
new FlxTimer().start(2 / 24, function(tmr) {
|
2023-08-06 22:20:18 -04:00
|
|
|
scale.x = scale.y = 1;
|
2023-01-22 19:55:30 -05:00
|
|
|
whiteShader.colorSet = false;
|
|
|
|
updateHitbox();
|
|
|
|
});
|
|
|
|
}
|
2020-10-21 14:05:27 -04:00
|
|
|
}
|
2021-02-24 20:52:59 -05:00
|
|
|
|
2022-09-28 02:50:53 -04:00
|
|
|
typedef SongFilter =
|
|
|
|
{
|
2023-01-22 19:55:30 -05:00
|
|
|
var filterType:FilterType;
|
|
|
|
var ?filterData:Dynamic;
|
2022-09-28 02:50:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
enum abstract FilterType(String)
|
|
|
|
{
|
2023-01-22 19:55:30 -05:00
|
|
|
var STARTSWITH;
|
2023-08-07 16:01:22 -04:00
|
|
|
var REGEXP;
|
2023-01-22 19:55:30 -05:00
|
|
|
var FAVORITE;
|
|
|
|
var ALL;
|
2022-09-28 02:50:53 -04:00
|
|
|
}
|
|
|
|
|
2023-06-09 18:25:21 -04:00
|
|
|
class FreeplaySongData
|
2021-02-24 20:52:59 -05:00
|
|
|
{
|
2023-01-22 19:55:30 -05:00
|
|
|
public var songName:String = "";
|
2023-06-09 18:25:21 -04:00
|
|
|
public var levelId:String = "";
|
2023-01-22 19:55:30 -05:00
|
|
|
public var songCharacter:String = "";
|
|
|
|
public var isFav:Bool = false;
|
|
|
|
|
2023-08-28 15:03:29 -04:00
|
|
|
public function new(song:String, levelId:String, songCharacter:String, isFav:Bool = false)
|
2023-01-22 19:55:30 -05:00
|
|
|
{
|
|
|
|
this.songName = song;
|
2023-06-09 18:25:21 -04:00
|
|
|
this.levelId = levelId;
|
2023-01-22 19:55:30 -05:00
|
|
|
this.songCharacter = songCharacter;
|
|
|
|
this.isFav = isFav;
|
|
|
|
}
|
2021-02-24 20:52:59 -05:00
|
|
|
}
|
2023-03-15 21:05:15 -04:00
|
|
|
|
|
|
|
typedef MoveData =
|
|
|
|
{
|
2023-03-16 00:17:52 -04:00
|
|
|
var ?x:Float;
|
|
|
|
var ?y:Float;
|
|
|
|
var ?speed:Float;
|
|
|
|
var ?wait:Float;
|
2023-03-15 21:05:15 -04:00
|
|
|
}
|