update
This commit is contained in:
+21
-49
@@ -7,84 +7,56 @@
|
||||
<anim name="confirm" anim="BF HEY!!" fps="24" loop="false"/>
|
||||
</char>
|
||||
|
||||
<!-- DAD -->
|
||||
<char name="dad" scale="0.5">
|
||||
<anim name="idle" anim="Dad idle dance BLACK LINE" fps="24" />
|
||||
</char>
|
||||
|
||||
<!-- GIRLFRIEND -->
|
||||
<char name="gf" scale="0.5">
|
||||
<anim name="idle" anim="GF Dancing Beat WHITE" fps="24" />
|
||||
</char>
|
||||
|
||||
<!-- SKID & PUMP -->
|
||||
<char name="spooky">
|
||||
<anim name="idle" anim="spooky dance idle BLACK LINES" fps="24" />
|
||||
</char>
|
||||
|
||||
<!-- PICO -->
|
||||
<char name="pico">
|
||||
<anim name="idle" anim="Pico Idle Dance" fps="24" />
|
||||
</char>
|
||||
|
||||
<!-- MOMMY MUST MURDER -->
|
||||
<char name="mom">
|
||||
<anim name="idle" anim="Mom Idle BLACK LINES" fps="24" />
|
||||
</char>
|
||||
|
||||
<!-- CHRISTMAS DADDY DEAREST AND MOMMY MUST MURDER -->
|
||||
<char name="parents-christmas" scale="0.9">
|
||||
<anim name="idle" anim="Parent Christmas Idle" fps="24" />
|
||||
</char>
|
||||
|
||||
<!-- SENPAI -->
|
||||
<char name="senpai">
|
||||
<anim name="idle" anim="SENPAI idle Black Lines" fps="24" />
|
||||
</char>
|
||||
<!-- ANIMATION IS AUTOMATICALLY ADDED. IF YOU WANT TO SPECIFY A PREFIX, ADD AN IDLE ANIM LIKE ABOVE. -->
|
||||
<char name="dad" scale="0.5" />
|
||||
<char name="gf" scale="0.5" />
|
||||
<char name="spooky" />
|
||||
<char name="pico" />
|
||||
<char name="mom" />
|
||||
<char name="parents-christmas" scale="0.9" />
|
||||
<char name="senpai" />
|
||||
</characters>
|
||||
<weeks>
|
||||
<!-- TUTORIAL -->
|
||||
<week name="" chars="dad,bf,gf">
|
||||
<!-- SPRITE BUTTONS ARE LOCATED IN "images/menus/storymenu/weeks/" -->
|
||||
<!-- IF NO SPRITE ARE SPECIFIED, "week(week number)" WILL BE USED. -->
|
||||
<!-- IF YOU WANT CUSTOM DIFFICULTIES, ADD THIS: difficulties="easy,normal,hard" -->
|
||||
<!-- DIFFICULTIES SPRITES IN "images/menus/storymenu/difficulties/" -->
|
||||
|
||||
<week name="" chars="dad,bf,gf" sprite="tutorial">
|
||||
<song name="Tutorial" show="true" />
|
||||
</week>
|
||||
|
||||
<!-- WEEK 1 -->
|
||||
<week name="DADDY DEAREST" chars="dad,bf,gf">
|
||||
<week name="DADDY DEAREST" chars="dad,bf,gf" sprite="week1">
|
||||
<song name="Bopeebo" />
|
||||
<song name="Fresh" />
|
||||
<song name="Dadbattle" />
|
||||
</week>
|
||||
|
||||
<!-- WEEK 2 -->
|
||||
<week name="SPOOKY MONTH" chars="spooky,bf,gf">
|
||||
<week name="SPOOKY MONTH" chars="spooky,bf,gf" sprite="week2">
|
||||
<song name="Spookeez" />
|
||||
<song name="South" />
|
||||
<song name="Monster" hide="true" />
|
||||
<song name="Monster" />
|
||||
</week>
|
||||
|
||||
<!-- WEEK 3 -->
|
||||
<week name="PICO" chars="pico,bf,gf">
|
||||
<week name="PICO" chars="pico,bf,gf" sprite="week3">
|
||||
<song name="Pico" />
|
||||
<song name="Philly" />
|
||||
<song name="Blammed" />
|
||||
</week>
|
||||
|
||||
<!-- WEEK 4 -->
|
||||
<week name="MOMMY MUST MURDER" chars="mom,bf,gf">
|
||||
<week name="MOMMY MUST MURDER" chars="mom,bf,gf" sprite="week4">
|
||||
<song name="Satin Panties" />
|
||||
<song name="High" />
|
||||
<song name="MILF" />
|
||||
</week>
|
||||
|
||||
<!-- WEEK 5 -->
|
||||
<week name="RED SNOW" chars="parents-christmas,bf,gf">
|
||||
<week name="RED SNOW" chars="parents-christmas,bf,gf" sprite="week5">
|
||||
<song name="Cocoa" />
|
||||
<song name="Eggnog" />
|
||||
<song name="Winter-Horrorland" hide="true" />
|
||||
</week>
|
||||
|
||||
<!-- WEEK 6 -->
|
||||
<week name="HATING SIMULATOR FT. MOAWLING" chars="senpai,bf,gf">
|
||||
<week name="HATING SIMULATOR FT. MOAWLING" chars="senpai,bf,gf" sprite="week6">
|
||||
<song name="Senpai" />
|
||||
<song name="Roses" />
|
||||
<song name="Thorns" hide="true" />
|
||||
|
||||
@@ -1,499 +1,63 @@
|
||||
package funkin.menus;
|
||||
|
||||
#if desktop
|
||||
import funkin.system.Discord.DiscordClient;
|
||||
#end
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.group.FlxGroup;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.util.FlxTimer;
|
||||
import lime.net.curl.CURLCode;
|
||||
import funkin.system.Song;
|
||||
import funkin.game.Highscore;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
import funkin.ui.FunkinText;
|
||||
import haxe.xml.Access;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.text.FlxText;
|
||||
|
||||
using StringTools;
|
||||
class StoryMenuState extends MusicBeatState {
|
||||
public var weekData:Array<WeekData> = [];
|
||||
|
||||
class StoryMenuState extends MusicBeatState
|
||||
{
|
||||
var scoreText:FlxText;
|
||||
public var characters:Map<String, MenuCharacter> = [];
|
||||
|
||||
var weekData:Array<Dynamic> = [
|
||||
['Tutorial'],
|
||||
['Bopeebo', 'Fresh', 'Dadbattle'],
|
||||
['Spookeez', 'South', "Monster"],
|
||||
['Pico', 'Philly', "Blammed"],
|
||||
['Satin-Panties', "High", "Milf"],
|
||||
['Cocoa', 'Eggnog', 'Winter-Horrorland'],
|
||||
['Senpai', 'Roses', 'Thorns']
|
||||
];
|
||||
var curDifficulty:Int = 1;
|
||||
public var scoreText:FlxText;
|
||||
public var tracklist:FlxText;
|
||||
public var weekTitle:FlxText;
|
||||
|
||||
public static var weekUnlocked:Array<Bool> = [true, true, true, true, true, true, true];
|
||||
public var curDifficulty:Int = 0;
|
||||
public var curWeek:Int = 0;
|
||||
|
||||
var weekCharacters:Array<Dynamic> = [
|
||||
['dad', 'bf', 'gf'],
|
||||
['dad', 'bf', 'gf'],
|
||||
['spooky', 'bf', 'gf'],
|
||||
['pico', 'bf', 'gf'],
|
||||
['mom', 'bf', 'gf'],
|
||||
['parents-christmas', 'bf', 'gf'],
|
||||
['senpai', 'bf', 'gf']
|
||||
];
|
||||
public var difficultySprites:Map<String, FlxSprite> = [];
|
||||
public var weekBG:FlxSprite;
|
||||
public var leftArrow:FlxSprite;
|
||||
public var rightArrow:FlxSprite;
|
||||
|
||||
var weekNames:Array<String> = [
|
||||
"",
|
||||
"Daddy Dearest",
|
||||
"Spooky Month",
|
||||
"PICO",
|
||||
"MOMMY MUST MURDER",
|
||||
"RED SNOW",
|
||||
"hating simulator ft. moawling"
|
||||
];
|
||||
|
||||
var txtWeekTitle:FlxText;
|
||||
public override function create() {
|
||||
super.create();
|
||||
loadXML();
|
||||
|
||||
persistentUpdate = persistentDraw = true;
|
||||
|
||||
var curWeek:Int = 0;
|
||||
scoreText = new FunkinText(10, 10, 0, "SCORE: -", 36);
|
||||
scoreText.setFormat(Paths.font("vcr.ttf"), 32);
|
||||
|
||||
var txtTracklist:FlxText;
|
||||
weekTitle = new FlxText(10, 10, FlxG.width - 20, "", 32);
|
||||
weekTitle.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, RIGHT);
|
||||
weekTitle.alpha = 0.7;
|
||||
|
||||
var grpWeekText:FlxTypedGroup<MenuItem>;
|
||||
var grpWeekCharacters:FlxTypedGroup<MenuCharacter>;
|
||||
weekBG = new FlxSprite(0, 56).makeGraphic(1, 1, 0xFFFFFFFF);
|
||||
weekBG.color = 0xFFF9CF51;
|
||||
weekBG.setGraphicSize(FlxG.width, 400);
|
||||
weekBG.updateHitbox();
|
||||
|
||||
var grpLocks:FlxTypedGroup<FlxSprite>;
|
||||
for(e in [scoreText, weekTitle, weekBG])
|
||||
add(e);
|
||||
}
|
||||
|
||||
var difficultySelectors:FlxGroup;
|
||||
var sprDifficulty:FlxSprite;
|
||||
var leftArrow:FlxSprite;
|
||||
var rightArrow:FlxSprite;
|
||||
|
||||
override function create()
|
||||
{
|
||||
CoolUtil.playMenuSong();
|
||||
|
||||
persistentUpdate = persistentDraw = true;
|
||||
|
||||
scoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36);
|
||||
scoreText.setFormat("VCR OSD Mono", 32);
|
||||
|
||||
txtWeekTitle = new FlxText(FlxG.width * 0.7, 10, 0, "", 32);
|
||||
txtWeekTitle.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, RIGHT);
|
||||
txtWeekTitle.alpha = 0.7;
|
||||
|
||||
var ui_tex = Paths.getSparrowAtlas('menus/storymenu/assets');
|
||||
var yellowBG:FlxSprite = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, 0xFFF9CF51);
|
||||
|
||||
grpWeekText = new FlxTypedGroup<MenuItem>();
|
||||
add(grpWeekText);
|
||||
|
||||
var blackBarThingie:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 56, FlxColor.BLACK);
|
||||
add(blackBarThingie);
|
||||
|
||||
grpWeekCharacters = new FlxTypedGroup<MenuCharacter>();
|
||||
|
||||
grpLocks = new FlxTypedGroup<FlxSprite>();
|
||||
add(grpLocks);
|
||||
|
||||
#if desktop
|
||||
// Updating Discord Rich Presence
|
||||
DiscordClient.changePresence("In the Menus", null);
|
||||
#end
|
||||
|
||||
for (i in 0...weekData.length)
|
||||
{
|
||||
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i);
|
||||
weekThing.y += ((weekThing.height + 20) * i);
|
||||
weekThing.targetY = i;
|
||||
grpWeekText.add(weekThing);
|
||||
|
||||
weekThing.screenCenter(X);
|
||||
weekThing.antialiasing = true;
|
||||
// weekThing.updateHitbox();
|
||||
|
||||
// Needs an offset thingie
|
||||
if (!weekUnlocked[i])
|
||||
{
|
||||
var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x);
|
||||
lock.frames = ui_tex;
|
||||
lock.animation.addByPrefix('lock', 'lock');
|
||||
lock.animation.play('lock');
|
||||
lock.ID = i;
|
||||
lock.antialiasing = true;
|
||||
grpLocks.add(lock);
|
||||
}
|
||||
}
|
||||
|
||||
for (char in 0...3)
|
||||
{
|
||||
var weekCharacterThing:MenuCharacter = new MenuCharacter((FlxG.width * 0.25) * (1 + char) - 150, weekCharacters[curWeek][char]);
|
||||
weekCharacterThing.y += 70;
|
||||
weekCharacterThing.antialiasing = true;
|
||||
switch (weekCharacterThing.character)
|
||||
{
|
||||
case 'dad':
|
||||
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5));
|
||||
weekCharacterThing.updateHitbox();
|
||||
|
||||
case 'bf':
|
||||
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.9));
|
||||
weekCharacterThing.updateHitbox();
|
||||
weekCharacterThing.x -= 80;
|
||||
case 'gf':
|
||||
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5));
|
||||
weekCharacterThing.updateHitbox();
|
||||
case 'pico':
|
||||
weekCharacterThing.flipX = true;
|
||||
case 'parents-christmas':
|
||||
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.9));
|
||||
weekCharacterThing.updateHitbox();
|
||||
}
|
||||
|
||||
grpWeekCharacters.add(weekCharacterThing);
|
||||
}
|
||||
|
||||
difficultySelectors = new FlxGroup();
|
||||
add(difficultySelectors);
|
||||
|
||||
leftArrow = new FlxSprite(grpWeekText.members[0].x + grpWeekText.members[0].width + 10, grpWeekText.members[0].y + 10);
|
||||
leftArrow.frames = ui_tex;
|
||||
leftArrow.animation.addByPrefix('idle', "arrow left");
|
||||
leftArrow.animation.addByPrefix('press', "arrow push left");
|
||||
leftArrow.animation.play('idle');
|
||||
difficultySelectors.add(leftArrow);
|
||||
|
||||
sprDifficulty = new FlxSprite(leftArrow.x + 130, leftArrow.y);
|
||||
sprDifficulty.frames = ui_tex;
|
||||
sprDifficulty.animation.addByPrefix('easy', 'EASY');
|
||||
sprDifficulty.animation.addByPrefix('normal', 'NORMAL');
|
||||
sprDifficulty.animation.addByPrefix('hard', 'HARD');
|
||||
sprDifficulty.animation.play('easy');
|
||||
changeDifficulty();
|
||||
|
||||
difficultySelectors.add(sprDifficulty);
|
||||
|
||||
rightArrow = new FlxSprite(sprDifficulty.x + sprDifficulty.width + 50, leftArrow.y);
|
||||
rightArrow.frames = ui_tex;
|
||||
rightArrow.animation.addByPrefix('idle', 'arrow right');
|
||||
rightArrow.animation.addByPrefix('press', "arrow push right", 24, false);
|
||||
rightArrow.animation.play('idle');
|
||||
difficultySelectors.add(rightArrow);
|
||||
|
||||
add(yellowBG);
|
||||
add(grpWeekCharacters);
|
||||
|
||||
txtTracklist = new FlxText(FlxG.width * 0.05, yellowBG.x + yellowBG.height + 100, 0, "Tracks", 32);
|
||||
txtTracklist.alignment = CENTER;
|
||||
txtTracklist.font = Paths.font("vcr.ttf");
|
||||
txtTracklist.color = 0xFFe55777;
|
||||
add(txtTracklist);
|
||||
// add(rankText);
|
||||
add(scoreText);
|
||||
add(txtWeekTitle);
|
||||
|
||||
updateText();
|
||||
|
||||
trace("Line 165");
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
// scoreText.setFormat('VCR OSD Mono', 32);
|
||||
lerpScore = Math.floor(lerp(lerpScore, intendedScore, 0.5));
|
||||
|
||||
scoreText.text = "WEEK SCORE:" + lerpScore;
|
||||
|
||||
txtWeekTitle.text = weekNames[curWeek].toUpperCase();
|
||||
txtWeekTitle.x = FlxG.width - (txtWeekTitle.width + 10);
|
||||
|
||||
// FlxG.watch.addQuick('font', scoreText.font);
|
||||
|
||||
difficultySelectors.visible = weekUnlocked[curWeek];
|
||||
|
||||
grpLocks.forEach(function(lock:FlxSprite)
|
||||
{
|
||||
lock.y = grpWeekText.members[lock.ID].y;
|
||||
});
|
||||
|
||||
if (!movedBack)
|
||||
{
|
||||
if (!selectedWeek)
|
||||
{
|
||||
if (controls.UP_P)
|
||||
{
|
||||
changeWeek(-1);
|
||||
}
|
||||
|
||||
if (controls.DOWN_P)
|
||||
{
|
||||
changeWeek(1);
|
||||
}
|
||||
|
||||
if (controls.RIGHT)
|
||||
rightArrow.animation.play('press')
|
||||
else
|
||||
rightArrow.animation.play('idle');
|
||||
|
||||
if (controls.LEFT)
|
||||
leftArrow.animation.play('press');
|
||||
else
|
||||
leftArrow.animation.play('idle');
|
||||
|
||||
if (controls.RIGHT_P)
|
||||
changeDifficulty(1);
|
||||
if (controls.LEFT_P)
|
||||
changeDifficulty(-1);
|
||||
}
|
||||
|
||||
if (controls.ACCEPT)
|
||||
{
|
||||
selectWeek();
|
||||
}
|
||||
}
|
||||
|
||||
if (controls.BACK && !movedBack && !selectedWeek)
|
||||
{
|
||||
CoolUtil.playMenuSFX(2);
|
||||
movedBack = true;
|
||||
FlxG.switchState(new MainMenuState());
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
var movedBack:Bool = false;
|
||||
var selectedWeek:Bool = false;
|
||||
var stopspamming:Bool = false;
|
||||
|
||||
function selectWeek()
|
||||
{
|
||||
if (weekUnlocked[curWeek])
|
||||
{
|
||||
if (stopspamming == false)
|
||||
{
|
||||
CoolUtil.playMenuSFX(1);
|
||||
|
||||
grpWeekText.members[curWeek].startFlashing();
|
||||
grpWeekCharacters.members[1].animation.play('bfConfirm');
|
||||
stopspamming = true;
|
||||
}
|
||||
|
||||
PlayState.storyPlaylist = weekData[curWeek];
|
||||
PlayState.isStoryMode = true;
|
||||
selectedWeek = true;
|
||||
|
||||
var diffic = "";
|
||||
|
||||
switch (curDifficulty)
|
||||
{
|
||||
case 0:
|
||||
diffic = '-easy';
|
||||
case 2:
|
||||
diffic = '-hard';
|
||||
}
|
||||
|
||||
PlayState.storyDifficulty = curDifficulty;
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase());
|
||||
PlayState.storyWeek = curWeek;
|
||||
PlayState.campaignScore = 0;
|
||||
new FlxTimer().start(1, function(tmr:FlxTimer)
|
||||
{
|
||||
FlxG.switchState(new PlayState());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function changeDifficulty(change:Int = 0):Void
|
||||
{
|
||||
curDifficulty += change;
|
||||
|
||||
if (curDifficulty < 0)
|
||||
curDifficulty = 2;
|
||||
if (curDifficulty > 2)
|
||||
curDifficulty = 0;
|
||||
|
||||
sprDifficulty.offset.x = 0;
|
||||
|
||||
switch (curDifficulty)
|
||||
{
|
||||
case 0:
|
||||
sprDifficulty.animation.play('easy');
|
||||
sprDifficulty.offset.x = 20;
|
||||
case 1:
|
||||
sprDifficulty.animation.play('normal');
|
||||
sprDifficulty.offset.x = 70;
|
||||
case 2:
|
||||
sprDifficulty.animation.play('hard');
|
||||
sprDifficulty.offset.x = 20;
|
||||
}
|
||||
|
||||
sprDifficulty.alpha = 0;
|
||||
|
||||
// USING THESE WEIRD VALUES SO THAT IT DOESNT FLOAT UP
|
||||
sprDifficulty.y = leftArrow.y - 15;
|
||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||
|
||||
#if !switch
|
||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||
#end
|
||||
|
||||
FlxTween.tween(sprDifficulty, {y: leftArrow.y + 15, alpha: 1}, 0.07);
|
||||
}
|
||||
|
||||
var lerpScore:Int = 0;
|
||||
var intendedScore:Int = 0;
|
||||
|
||||
function changeWeek(change:Int = 0):Void
|
||||
{
|
||||
curWeek += change;
|
||||
|
||||
if (curWeek >= weekData.length)
|
||||
curWeek = 0;
|
||||
if (curWeek < 0)
|
||||
curWeek = weekData.length - 1;
|
||||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
for (item in grpWeekText.members)
|
||||
{
|
||||
item.targetY = bullShit - curWeek;
|
||||
if (item.targetY == Std.int(0) && weekUnlocked[curWeek])
|
||||
item.alpha = 1;
|
||||
else
|
||||
item.alpha = 0.6;
|
||||
bullShit++;
|
||||
}
|
||||
|
||||
CoolUtil.playMenuSFX(0);
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
function updateText()
|
||||
{
|
||||
grpWeekCharacters.members[0].animation.play(weekCharacters[curWeek][0]);
|
||||
grpWeekCharacters.members[1].animation.play(weekCharacters[curWeek][1]);
|
||||
grpWeekCharacters.members[2].animation.play(weekCharacters[curWeek][2]);
|
||||
txtTracklist.text = "Tracks\n";
|
||||
|
||||
switch (grpWeekCharacters.members[0].animation.curAnim.name)
|
||||
{
|
||||
case 'parents-christmas':
|
||||
grpWeekCharacters.members[0].offset.set(200, 200);
|
||||
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 0.99));
|
||||
|
||||
case 'senpai':
|
||||
grpWeekCharacters.members[0].offset.set(130, 0);
|
||||
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1.4));
|
||||
|
||||
case 'mom':
|
||||
grpWeekCharacters.members[0].offset.set(100, 200);
|
||||
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1));
|
||||
|
||||
case 'dad':
|
||||
grpWeekCharacters.members[0].offset.set(120, 200);
|
||||
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1));
|
||||
|
||||
default:
|
||||
grpWeekCharacters.members[0].offset.set(100, 100);
|
||||
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1));
|
||||
// grpWeekCharacters.members[0].updateHitbox();
|
||||
}
|
||||
|
||||
var stringThing:Array<String> = weekData[curWeek];
|
||||
|
||||
for (i in stringThing)
|
||||
{
|
||||
txtTracklist.text += "\n" + i;
|
||||
}
|
||||
|
||||
txtTracklist.text = txtTracklist.text.toUpperCase();
|
||||
|
||||
txtTracklist.screenCenter(X);
|
||||
txtTracklist.x -= FlxG.width * 0.35;
|
||||
|
||||
#if !switch
|
||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||
#end
|
||||
}
|
||||
public function loadXML() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MenuCharacter extends FlxSprite
|
||||
{
|
||||
public var character:String;
|
||||
|
||||
public function new(x:Float, character:String = 'bf')
|
||||
{
|
||||
super(x);
|
||||
|
||||
this.character = character;
|
||||
|
||||
var tex = Paths.getSparrowAtlas('menus/storymenu/characters');
|
||||
frames = tex;
|
||||
|
||||
animation.addByPrefix('bf', "BF idle dance white", 24);
|
||||
animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false);
|
||||
animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24);
|
||||
animation.addByPrefix('dad', "Dad idle dance BLACK LINE", 24);
|
||||
animation.addByPrefix('spooky', "spooky dance idle BLACK LINES", 24);
|
||||
animation.addByPrefix('pico', "Pico Idle Dance", 24);
|
||||
animation.addByPrefix('mom', "Mom Idle BLACK LINES", 24);
|
||||
animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24);
|
||||
animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24);
|
||||
// Parent Christmas Idle
|
||||
|
||||
animation.play(character);
|
||||
updateHitbox();
|
||||
}
|
||||
typedef WeekData = {
|
||||
|
||||
}
|
||||
|
||||
class MenuItem extends FlxSpriteGroup
|
||||
{
|
||||
public var targetY:Float = 0;
|
||||
public var week:FlxSprite;
|
||||
public var flashingInt:Int = 0;
|
||||
|
||||
public function new(x:Float, y:Float, weekNum:Int = 0)
|
||||
{
|
||||
super(x, y);
|
||||
week = new FlxSprite().loadGraphic(Paths.image('menus/storymenu/week' + weekNum));
|
||||
add(week);
|
||||
}
|
||||
|
||||
private var isFlashing:Bool = false;
|
||||
|
||||
public function startFlashing():Void
|
||||
{
|
||||
isFlashing = true;
|
||||
}
|
||||
|
||||
// if it runs at 60fps, fake framerate will be 6
|
||||
// if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still???
|
||||
// so it runs basically every so many seconds, not dependant on framerate??
|
||||
// I'm still learning how math works thanks whoever is reading this lol
|
||||
var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10);
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
|
||||
|
||||
if (isFlashing)
|
||||
flashingInt += 1;
|
||||
|
||||
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2))
|
||||
week.color = 0xFF33ffff;
|
||||
else
|
||||
week.color = FlxColor.WHITE;
|
||||
}
|
||||
}
|
||||
class MenuCharacter extends FlxSprite {
|
||||
public function new(xml:Access) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,475 @@
|
||||
package funkin.menus;
|
||||
|
||||
#if desktop
|
||||
import funkin.system.Discord.DiscordClient;
|
||||
#end
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.group.FlxGroup;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.util.FlxTimer;
|
||||
import lime.net.curl.CURLCode;
|
||||
import funkin.system.Song;
|
||||
import funkin.game.Highscore;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
|
||||
using StringTools;
|
||||
|
||||
class StoryMenuState extends MusicBeatState
|
||||
{
|
||||
var scoreText:FlxText;
|
||||
|
||||
var weekData:Array<Dynamic> = [
|
||||
['Tutorial'],
|
||||
['Bopeebo', 'Fresh', 'Dadbattle'],
|
||||
['Spookeez', 'South', "Monster"],
|
||||
['Pico', 'Philly', "Blammed"],
|
||||
['Satin-Panties', "High", "Milf"],
|
||||
['Cocoa', 'Eggnog', 'Winter-Horrorland'],
|
||||
['Senpai', 'Roses', 'Thorns']
|
||||
];
|
||||
var curDifficulty:Int = 1;
|
||||
|
||||
public static var weekUnlocked:Array<Bool> = [true, true, true, true, true, true, true];
|
||||
|
||||
var weekCharacters:Array<Dynamic> = [
|
||||
['dad', 'bf', 'gf'],
|
||||
['dad', 'bf', 'gf'],
|
||||
['spooky', 'bf', 'gf'],
|
||||
['pico', 'bf', 'gf'],
|
||||
['mom', 'bf', 'gf'],
|
||||
['parents-christmas', 'bf', 'gf'],
|
||||
['senpai', 'bf', 'gf']
|
||||
];
|
||||
|
||||
var weekNames:Array<String> = [
|
||||
"",
|
||||
"Daddy Dearest",
|
||||
"Spooky Month",
|
||||
"PICO",
|
||||
"MOMMY MUST MURDER",
|
||||
"RED SNOW",
|
||||
"hating simulator ft. moawling"
|
||||
];
|
||||
|
||||
var txtWeekTitle:FlxText;
|
||||
|
||||
var curWeek:Int = 0;
|
||||
|
||||
var txtTracklist:FlxText;
|
||||
|
||||
var grpWeekText:FlxTypedGroup<MenuItem>;
|
||||
var grpWeekCharacters:FlxTypedGroup<MenuCharacter>;
|
||||
|
||||
var grpLocks:FlxTypedGroup<FlxSprite>;
|
||||
|
||||
var difficultySelectors:FlxGroup;
|
||||
var sprDifficulty:FlxSprite;
|
||||
var leftArrow:FlxSprite;
|
||||
var rightArrow:FlxSprite;
|
||||
|
||||
override function create()
|
||||
{
|
||||
CoolUtil.playMenuSong();
|
||||
|
||||
persistentUpdate = persistentDraw = true;
|
||||
|
||||
scoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36);
|
||||
scoreText.setFormat("VCR OSD Mono", 32);
|
||||
|
||||
txtWeekTitle = new FlxText(FlxG.width * 0.7, 10, 0, "", 32);
|
||||
txtWeekTitle.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, RIGHT);
|
||||
txtWeekTitle.alpha = 0.7;
|
||||
|
||||
var ui_tex = Paths.getSparrowAtlas('menus/storymenu/assets');
|
||||
var yellowBG:FlxSprite = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, 0xFFF9CF51);
|
||||
|
||||
grpWeekText = new FlxTypedGroup<MenuItem>();
|
||||
add(grpWeekText);
|
||||
|
||||
var blackBarThingie:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 56, FlxColor.BLACK);
|
||||
add(blackBarThingie);
|
||||
|
||||
grpWeekCharacters = new FlxTypedGroup<MenuCharacter>();
|
||||
|
||||
grpLocks = new FlxTypedGroup<FlxSprite>();
|
||||
add(grpLocks);
|
||||
|
||||
#if desktop
|
||||
// Updating Discord Rich Presence
|
||||
DiscordClient.changePresence("In the Menus", null);
|
||||
#end
|
||||
|
||||
for (i in 0...weekData.length)
|
||||
{
|
||||
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i);
|
||||
weekThing.y += ((weekThing.height + 20) * i);
|
||||
weekThing.targetY = i;
|
||||
grpWeekText.add(weekThing);
|
||||
|
||||
weekThing.screenCenter(X);
|
||||
weekThing.antialiasing = true;
|
||||
// weekThing.updateHitbox();
|
||||
|
||||
// Needs an offset thingie
|
||||
if (!weekUnlocked[i])
|
||||
{
|
||||
var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x);
|
||||
lock.frames = ui_tex;
|
||||
lock.animation.addByPrefix('lock', 'lock');
|
||||
lock.animation.play('lock');
|
||||
lock.ID = i;
|
||||
lock.antialiasing = true;
|
||||
grpLocks.add(lock);
|
||||
}
|
||||
}
|
||||
|
||||
for (char in 0...3)
|
||||
{
|
||||
var weekCharacterThing:MenuCharacter = new MenuCharacter((FlxG.width * 0.25) * (1 + char) - 150, weekCharacters[curWeek][char]);
|
||||
weekCharacterThing.y += 70;
|
||||
weekCharacterThing.antialiasing = true;
|
||||
switch (weekCharacterThing.character)
|
||||
{
|
||||
case 'dad':
|
||||
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5));
|
||||
weekCharacterThing.updateHitbox();
|
||||
|
||||
case 'bf':
|
||||
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.9));
|
||||
weekCharacterThing.updateHitbox();
|
||||
weekCharacterThing.x -= 80;
|
||||
case 'gf':
|
||||
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5));
|
||||
weekCharacterThing.updateHitbox();
|
||||
case 'pico':
|
||||
weekCharacterThing.flipX = true;
|
||||
case 'parents-christmas':
|
||||
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.9));
|
||||
weekCharacterThing.updateHitbox();
|
||||
}
|
||||
|
||||
grpWeekCharacters.add(weekCharacterThing);
|
||||
}
|
||||
|
||||
difficultySelectors = new FlxGroup();
|
||||
add(difficultySelectors);
|
||||
|
||||
leftArrow = new FlxSprite(grpWeekText.members[0].x + grpWeekText.members[0].width + 10, grpWeekText.members[0].y + 10);
|
||||
leftArrow.frames = ui_tex;
|
||||
leftArrow.animation.addByPrefix('idle', "arrow left");
|
||||
leftArrow.animation.addByPrefix('press', "arrow push left");
|
||||
leftArrow.animation.play('idle');
|
||||
difficultySelectors.add(leftArrow);
|
||||
|
||||
sprDifficulty = new FlxSprite(leftArrow.x + 130, leftArrow.y);
|
||||
sprDifficulty.frames = ui_tex;
|
||||
sprDifficulty.animation.addByPrefix('easy', 'EASY');
|
||||
sprDifficulty.animation.addByPrefix('normal', 'NORMAL');
|
||||
sprDifficulty.animation.addByPrefix('hard', 'HARD');
|
||||
sprDifficulty.animation.play('easy');
|
||||
changeDifficulty();
|
||||
|
||||
difficultySelectors.add(sprDifficulty);
|
||||
|
||||
rightArrow = new FlxSprite(sprDifficulty.x + sprDifficulty.width + 50, leftArrow.y);
|
||||
rightArrow.frames = ui_tex;
|
||||
rightArrow.animation.addByPrefix('idle', 'arrow right');
|
||||
rightArrow.animation.addByPrefix('press', "arrow push right", 24, false);
|
||||
rightArrow.animation.play('idle');
|
||||
difficultySelectors.add(rightArrow);
|
||||
|
||||
add(yellowBG);
|
||||
add(grpWeekCharacters);
|
||||
|
||||
txtTracklist = new FlxText(FlxG.width * 0.05, yellowBG.x + yellowBG.height + 100, 0, "Tracks", 32);
|
||||
txtTracklist.alignment = CENTER;
|
||||
txtTracklist.font = Paths.font("vcr.ttf");
|
||||
txtTracklist.color = 0xFFe55777;
|
||||
add(txtTracklist);
|
||||
// add(rankText);
|
||||
add(scoreText);
|
||||
add(txtWeekTitle);
|
||||
|
||||
updateText();
|
||||
|
||||
trace("Line 165");
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
// scoreText.setFormat('VCR OSD Mono', 32);
|
||||
lerpScore = Math.floor(lerp(lerpScore, intendedScore, 0.5));
|
||||
|
||||
scoreText.text = "WEEK SCORE:" + lerpScore;
|
||||
|
||||
txtWeekTitle.text = weekNames[curWeek].toUpperCase();
|
||||
txtWeekTitle.x = FlxG.width - (txtWeekTitle.width + 10);
|
||||
|
||||
// FlxG.watch.addQuick('font', scoreText.font);
|
||||
|
||||
difficultySelectors.visible = weekUnlocked[curWeek];
|
||||
|
||||
grpLocks.forEach(function(lock:FlxSprite)
|
||||
{
|
||||
lock.y = grpWeekText.members[lock.ID].y;
|
||||
});
|
||||
|
||||
if (!movedBack)
|
||||
{
|
||||
if (!selectedWeek)
|
||||
{
|
||||
if (controls.UP_P)
|
||||
{
|
||||
changeWeek(-1);
|
||||
}
|
||||
|
||||
if (controls.DOWN_P)
|
||||
{
|
||||
changeWeek(1);
|
||||
}
|
||||
|
||||
if (controls.RIGHT)
|
||||
rightArrow.animation.play('press')
|
||||
else
|
||||
rightArrow.animation.play('idle');
|
||||
|
||||
if (controls.LEFT)
|
||||
leftArrow.animation.play('press');
|
||||
else
|
||||
leftArrow.animation.play('idle');
|
||||
|
||||
if (controls.RIGHT_P)
|
||||
changeDifficulty(1);
|
||||
if (controls.LEFT_P)
|
||||
changeDifficulty(-1);
|
||||
}
|
||||
|
||||
if (controls.ACCEPT)
|
||||
{
|
||||
selectWeek();
|
||||
}
|
||||
}
|
||||
|
||||
if (controls.BACK && !movedBack && !selectedWeek)
|
||||
{
|
||||
CoolUtil.playMenuSFX(2);
|
||||
movedBack = true;
|
||||
FlxG.switchState(new MainMenuState());
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
var movedBack:Bool = false;
|
||||
var selectedWeek:Bool = false;
|
||||
var stopspamming:Bool = false;
|
||||
|
||||
function selectWeek()
|
||||
{
|
||||
if (weekUnlocked[curWeek])
|
||||
{
|
||||
if (stopspamming == false)
|
||||
{
|
||||
CoolUtil.playMenuSFX(1);
|
||||
|
||||
grpWeekText.members[curWeek].startFlashing();
|
||||
grpWeekCharacters.members[1].animation.play('bfConfirm');
|
||||
stopspamming = true;
|
||||
}
|
||||
|
||||
PlayState.storyPlaylist = weekData[curWeek];
|
||||
PlayState.isStoryMode = true;
|
||||
selectedWeek = true;
|
||||
|
||||
var diffic = "";
|
||||
|
||||
switch (curDifficulty)
|
||||
{
|
||||
case 0:
|
||||
diffic = '-easy';
|
||||
case 2:
|
||||
diffic = '-hard';
|
||||
}
|
||||
|
||||
PlayState.storyDifficulty = curDifficulty;
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase());
|
||||
PlayState.storyWeek = curWeek;
|
||||
PlayState.campaignScore = 0;
|
||||
new FlxTimer().start(1, function(tmr:FlxTimer)
|
||||
{
|
||||
FlxG.switchState(new PlayState());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function changeDifficulty(change:Int = 0):Void
|
||||
{
|
||||
curDifficulty += change;
|
||||
|
||||
if (curDifficulty < 0)
|
||||
curDifficulty = 2;
|
||||
if (curDifficulty > 2)
|
||||
curDifficulty = 0;
|
||||
|
||||
sprDifficulty.offset.x = 0;
|
||||
|
||||
switch (curDifficulty)
|
||||
{
|
||||
case 0:
|
||||
sprDifficulty.animation.play('easy');
|
||||
sprDifficulty.offset.x = 20;
|
||||
case 1:
|
||||
sprDifficulty.animation.play('normal');
|
||||
sprDifficulty.offset.x = 70;
|
||||
case 2:
|
||||
sprDifficulty.animation.play('hard');
|
||||
sprDifficulty.offset.x = 20;
|
||||
}
|
||||
|
||||
sprDifficulty.alpha = 0;
|
||||
|
||||
// USING THESE WEIRD VALUES SO THAT IT DOESNT FLOAT UP
|
||||
sprDifficulty.y = leftArrow.y - 15;
|
||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||
|
||||
#if !switch
|
||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||
#end
|
||||
|
||||
FlxTween.tween(sprDifficulty, {y: leftArrow.y + 15, alpha: 1}, 0.07);
|
||||
}
|
||||
|
||||
var lerpScore:Int = 0;
|
||||
var intendedScore:Int = 0;
|
||||
|
||||
function changeWeek(change:Int = 0):Void
|
||||
{
|
||||
curWeek += change;
|
||||
|
||||
if (curWeek >= weekData.length)
|
||||
curWeek = 0;
|
||||
if (curWeek < 0)
|
||||
curWeek = weekData.length - 1;
|
||||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
for (item in grpWeekText.members)
|
||||
{
|
||||
item.targetY = bullShit - curWeek;
|
||||
if (item.targetY == Std.int(0) && weekUnlocked[curWeek])
|
||||
item.alpha = 1;
|
||||
else
|
||||
item.alpha = 0.6;
|
||||
bullShit++;
|
||||
}
|
||||
|
||||
CoolUtil.playMenuSFX(0);
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
function updateText()
|
||||
{
|
||||
grpWeekCharacters.members[0].animation.play(weekCharacters[curWeek][0]);
|
||||
grpWeekCharacters.members[1].animation.play(weekCharacters[curWeek][1]);
|
||||
grpWeekCharacters.members[2].animation.play(weekCharacters[curWeek][2]);
|
||||
txtTracklist.text = "Tracks\n";
|
||||
|
||||
var stringThing:Array<String> = weekData[curWeek];
|
||||
|
||||
for (i in stringThing)
|
||||
{
|
||||
txtTracklist.text += "\n" + i;
|
||||
}
|
||||
|
||||
txtTracklist.text = txtTracklist.text.toUpperCase();
|
||||
|
||||
txtTracklist.screenCenter(X);
|
||||
txtTracklist.x -= FlxG.width * 0.35;
|
||||
|
||||
#if !switch
|
||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MenuCharacter extends FlxSprite
|
||||
{
|
||||
public var character:String;
|
||||
|
||||
public function new(x:Float, character:String = 'bf')
|
||||
{
|
||||
super(x);
|
||||
|
||||
this.character = character;
|
||||
|
||||
var tex = Paths.getSparrowAtlas('menus/storymenu/characters');
|
||||
frames = tex;
|
||||
|
||||
animation.addByPrefix('bf', "BF idle dance white", 24);
|
||||
animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false);
|
||||
animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24);
|
||||
animation.addByPrefix('dad', "Dad idle dance BLACK LINE", 24);
|
||||
animation.addByPrefix('spooky', "spooky dance idle BLACK LINES", 24);
|
||||
animation.addByPrefix('pico', "Pico Idle Dance", 24);
|
||||
animation.addByPrefix('mom', "Mom Idle BLACK LINES", 24);
|
||||
animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24);
|
||||
animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24);
|
||||
// Parent Christmas Idle
|
||||
|
||||
animation.play(character);
|
||||
updateHitbox();
|
||||
}
|
||||
}
|
||||
|
||||
class MenuItem extends FlxSpriteGroup
|
||||
{
|
||||
public var targetY:Float = 0;
|
||||
public var week:FlxSprite;
|
||||
public var flashingInt:Int = 0;
|
||||
|
||||
public function new(x:Float, y:Float, weekNum:Int = 0)
|
||||
{
|
||||
super(x, y);
|
||||
week = new FlxSprite().loadGraphic(Paths.image('menus/storymenu/week' + weekNum));
|
||||
add(week);
|
||||
}
|
||||
|
||||
private var isFlashing:Bool = false;
|
||||
|
||||
public function startFlashing():Void
|
||||
{
|
||||
isFlashing = true;
|
||||
}
|
||||
|
||||
// if it runs at 60fps, fake framerate will be 6
|
||||
// if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still???
|
||||
// so it runs basically every so many seconds, not dependant on framerate??
|
||||
// I'm still learning how math works thanks whoever is reading this lol
|
||||
var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10);
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
|
||||
|
||||
if (isFlashing)
|
||||
flashingInt += 1;
|
||||
|
||||
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2))
|
||||
week.color = 0xFF33ffff;
|
||||
else
|
||||
week.color = FlxColor.WHITE;
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,13 @@ import flixel.util.FlxColor;
|
||||
import flixel.text.FlxText;
|
||||
|
||||
class FunkinText extends FlxText {
|
||||
public function new(X:Float = 0, Y:Float = 0, FieldWidth:Float = 0, ?Text:String, Size:Int = 16, EmbeddedFont:Bool = true) {
|
||||
super(X, Y, FieldWidth, Text, Size, EmbeddedFont);
|
||||
public function new(X:Float = 0, Y:Float = 0, FieldWidth:Float = 0, ?Text:String, Size:Int = 16, Border:Bool = true) {
|
||||
super(X, Y, FieldWidth, Text, Size);
|
||||
setFormat(Paths.font("vcr.ttf"), Size, FlxColor.WHITE);
|
||||
borderStyle = OUTLINE;
|
||||
borderSize = 1;
|
||||
borderColor = 0xFF000000;
|
||||
if (Border) {
|
||||
borderStyle = OUTLINE;
|
||||
borderSize = 1;
|
||||
borderColor = 0xFF000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user