latest halloween
This commit is contained in:
@ -6,6 +6,9 @@ import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.group.FlxGroup;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.util.FlxTimer;
|
||||
import lime.net.curl.CURLCode;
|
||||
|
||||
using StringTools;
|
||||
|
||||
@ -13,31 +16,38 @@ class StoryMenuState extends MusicBeatState
|
||||
{
|
||||
var scoreText:FlxText;
|
||||
|
||||
var weekData:Array<Dynamic> = [['Tutorial', 'Bopeebo', 'Fresh', 'Dad Battle'], ['Spookeez', 'South', 'Monster']];
|
||||
var weekUnlocked:Array<Bool> = [true, false];
|
||||
var weekData:Array<Dynamic> = [['Tutorial', 'Bopeebo', 'Fresh', 'Dadbattle'], ['Spookeez', 'South', 'Monster']];
|
||||
var curDifficulty:Int = 1;
|
||||
|
||||
public static var weekUnlocked:Array<Bool> = [true, false];
|
||||
|
||||
var weekCharacters:Array<Dynamic> = [['dad', 'bf', 'gf'], ['spooky', 'bf', 'gf']];
|
||||
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()
|
||||
{
|
||||
persistentUpdate = persistentDraw = true;
|
||||
|
||||
scoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36);
|
||||
scoreText.setFormat("VCR OSD Mono", 32);
|
||||
add(scoreText);
|
||||
|
||||
var rankText:FlxText = new FlxText(0, 10);
|
||||
rankText.text = 'RANK: GREAT';
|
||||
rankText.setFormat("assets/fonts/vcr.ttf", 32);
|
||||
rankText.size = scoreText.size;
|
||||
rankText.screenCenter(X);
|
||||
add(rankText);
|
||||
|
||||
var ui_tex = FlxAtlasFrames.fromSparrow(AssetPaths.campaign_menu_UI_assets__png, AssetPaths.campaign_menu_UI_assets__xml);
|
||||
var yellowBG:FlxSprite = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, 0xFFF9CF51);
|
||||
@ -45,6 +55,8 @@ class StoryMenuState extends MusicBeatState
|
||||
grpWeekText = new FlxTypedGroup<MenuItem>();
|
||||
add(grpWeekText);
|
||||
|
||||
grpWeekCharacters = new FlxTypedGroup<MenuCharacter>();
|
||||
|
||||
grpLocks = new FlxTypedGroup<FlxSprite>();
|
||||
add(grpLocks);
|
||||
|
||||
@ -76,36 +88,65 @@ class StoryMenuState extends MusicBeatState
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
case 'gf':
|
||||
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5));
|
||||
weekCharacterThing.updateHitbox();
|
||||
}
|
||||
|
||||
grpWeekCharacters.add(weekCharacterThing);
|
||||
}
|
||||
|
||||
difficultySelectors = new FlxGroup();
|
||||
add(difficultySelectors);
|
||||
|
||||
var leftArrow:FlxSprite = new FlxSprite(grpWeekText.members[0].x + 400, grpWeekText.members[0].y + 10);
|
||||
leftArrow = new FlxSprite(grpWeekText.members[0].x + 370, 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);
|
||||
|
||||
var sprDifficulty:FlxSprite = new FlxSprite(leftArrow.x + 70, leftArrow.y);
|
||||
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);
|
||||
|
||||
var rightArrow:FlxSprite = new FlxSprite(sprDifficulty.x + sprDifficulty.width + 20, sprDifficulty.y);
|
||||
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 = rankText.font;
|
||||
txtTracklist.color = 0xFFe55777;
|
||||
add(txtTracklist);
|
||||
add(rankText);
|
||||
add(scoreText);
|
||||
|
||||
updateText();
|
||||
|
||||
@ -125,14 +166,119 @@ class StoryMenuState extends MusicBeatState
|
||||
lock.y = grpWeekText.members[lock.ID].y;
|
||||
});
|
||||
|
||||
if (controls.UP_P)
|
||||
changeWeek(-1);
|
||||
if (controls.DOWN_P)
|
||||
changeWeek(1);
|
||||
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)
|
||||
{
|
||||
FlxG.sound.play('assets/sounds/cancelMenu' + TitleState.soundExt);
|
||||
movedBack = true;
|
||||
FlxG.switchState(new MainMenuState());
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
var movedBack:Bool = false;
|
||||
var selectedWeek:Bool = false;
|
||||
|
||||
function selectWeek()
|
||||
{
|
||||
if (weekUnlocked[curWeek])
|
||||
{
|
||||
FlxG.sound.play('assets/sounds/confirmMenu' + TitleState.soundExt);
|
||||
|
||||
grpWeekText.members[curWeek].week.animation.resume();
|
||||
grpWeekCharacters.members[1].animation.play('bfConfirm');
|
||||
|
||||
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());
|
||||
new FlxTimer().start(1, function(tmr:FlxTimer)
|
||||
{
|
||||
FlxG.sound.music.stop();
|
||||
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;
|
||||
sprDifficulty.y -= 15;
|
||||
|
||||
FlxTween.tween(sprDifficulty, {y: sprDifficulty.y + 15, alpha: 1}, 0.07);
|
||||
}
|
||||
|
||||
function changeWeek(change:Int = 0):Void
|
||||
{
|
||||
curWeek += change;
|
||||
@ -150,11 +296,16 @@ class StoryMenuState extends MusicBeatState
|
||||
bullShit++;
|
||||
}
|
||||
|
||||
FlxG.sound.play('assets/sounds/scrollMenu' + TitleState.soundExt);
|
||||
|
||||
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];
|
||||
|
Reference in New Issue
Block a user