diff --git a/Project.xml b/Project.xml
index 4536d8c09..b40d81b5c 100644
--- a/Project.xml
+++ b/Project.xml
@@ -94,5 +94,5 @@
-
+
diff --git a/source/PlayState.hx b/source/PlayState.hx
index 4aa012854..29aeb7335 100644
--- a/source/PlayState.hx
+++ b/source/PlayState.hx
@@ -38,6 +38,7 @@ class PlayState extends MusicBeatState
public static var SONG:SwagSong;
public static var isStoryMode:Bool = false;
public static var storyPlaylist:Array = [];
+ public static var storyDifficulty:Int = 1;
var halloweenLevel:Bool = false;
@@ -257,7 +258,9 @@ class PlayState extends MusicBeatState
// healthBar.visible = healthHeads.visible = healthBarBG.visible = false;
if (isStoryMode)
{
- add(doof);
+ // TEMP for now, later get rid of startCountdown()
+ // add(doof);
+ startCountdown();
}
else
startCountdown();
@@ -814,7 +817,15 @@ class PlayState extends MusicBeatState
}
else
{
- PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase());
+ var difficulty:String = "";
+
+ if (storyDifficulty == 0)
+ difficulty = '-easy';
+
+ if (storyDifficulty == 2)
+ difficulty == '-hard';
+
+ PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + difficulty, PlayState.storyPlaylist[0]);
FlxG.switchState(new PlayState());
}
}
diff --git a/source/Song.hx b/source/Song.hx
index 3c2ac41be..aa75d3951 100644
--- a/source/Song.hx
+++ b/source/Song.hx
@@ -47,9 +47,9 @@ class Song
}
}
- public static function loadFromJson(jsonInput:String):SwagSong
+ public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
{
- var rawJson = Assets.getText('assets/data/' + jsonInput.toLowerCase() + '/' + jsonInput.toLowerCase() + '.json').trim();
+ var rawJson = Assets.getText('assets/data/' + folder.toLowerCase() + '/' + jsonInput.toLowerCase() + '.json').trim();
while (!rawJson.endsWith("}"))
{
diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx
index e314eb7e2..093746479 100644
--- a/source/StoryMenuState.hx
+++ b/source/StoryMenuState.hx
@@ -6,7 +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;
@@ -15,6 +17,7 @@ class StoryMenuState extends MusicBeatState
var scoreText:FlxText;
var weekData:Array = [['Tutorial', 'Bopeebo', 'Fresh', 'Dadbattle'], ['Spookeez', 'South', 'Monster']];
+ var curDifficulty:Int = 1;
public static var weekUnlocked:Array = [true, false];
@@ -29,6 +32,9 @@ class StoryMenuState extends MusicBeatState
var grpLocks:FlxTypedGroup;
var difficultySelectors:FlxGroup;
+ var sprDifficulty:FlxSprite;
+ var leftArrow:FlxSprite;
+ var rightArrow:FlxSprite;
override function create()
{
@@ -107,23 +113,27 @@ class StoryMenuState extends MusicBeatState
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);
@@ -169,6 +179,21 @@ class StoryMenuState extends MusicBeatState
{
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)
@@ -202,7 +227,20 @@ class StoryMenuState extends MusicBeatState
PlayState.storyPlaylist = weekData[curWeek];
PlayState.isStoryMode = true;
selectedWeek = true;
- PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase());
+
+ 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();
@@ -211,6 +249,36 @@ class StoryMenuState extends MusicBeatState
}
}
+ 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;
diff --git a/source/TitleState.hx b/source/TitleState.hx
index 71c6e8af8..72cae1944 100644
--- a/source/TitleState.hx
+++ b/source/TitleState.hx
@@ -54,7 +54,7 @@ class TitleState extends MusicBeatState
super.create();
#if SKIP_TO_PLAYSTATE
- FlxG.switchState(new PlayState());
+ FlxG.switchState(new StoryMenuState());
#else
startIntro();
#end