mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-26 23:16:46 +00:00
difficulty UI
This commit is contained in:
parent
047b9af8ec
commit
9ea6981f22
|
@ -94,5 +94,5 @@
|
|||
|
||||
<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
|
||||
<icon path="art/icon.png"/>
|
||||
<!-- <haxedef name="SKIP_TO_PLAYSTATE" if="debug" /> -->
|
||||
<haxedef name="SKIP_TO_PLAYSTATE" if="debug" />
|
||||
</project>
|
||||
|
|
|
@ -38,6 +38,7 @@ class PlayState extends MusicBeatState
|
|||
public static var SONG:SwagSong;
|
||||
public static var isStoryMode:Bool = false;
|
||||
public static var storyPlaylist:Array<String> = [];
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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("}"))
|
||||
{
|
||||
|
|
|
@ -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<Dynamic> = [['Tutorial', 'Bopeebo', 'Fresh', 'Dadbattle'], ['Spookeez', 'South', 'Monster']];
|
||||
var curDifficulty:Int = 1;
|
||||
|
||||
public static var weekUnlocked:Array<Bool> = [true, false];
|
||||
|
||||
|
@ -29,6 +32,9 @@ class StoryMenuState extends MusicBeatState
|
|||
var grpLocks:FlxTypedGroup<FlxSprite>;
|
||||
|
||||
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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue