This commit is contained in:
Yoshman29
2022-11-03 21:17:54 +01:00
parent e96e62e894
commit 9d4176d0ca
5 changed files with 43 additions and 11 deletions
+1 -1
View File
@@ -1 +1 @@
1081
1084
+1 -5
View File
@@ -206,11 +206,7 @@ class FreeplayState extends MusicBeatState
if (controls.ACCEPT)
{
PlayState.SONG = Song.loadFromJson(songs[curSelected].songName, songs[curSelected].difficulties[curDifficulty]);
PlayState.isStoryMode = false;
// PlayState.storyWeek = songs[curSelected].week;
trace('CUR WEEK' + PlayState.storyWeek);
CoolUtil.loadSong(songs[curSelected].songName, songs[curSelected].difficulties[curDifficulty]);
FlxG.switchState(new PlayState());
}
}
+1 -1
View File
@@ -44,7 +44,7 @@ class PauseSubState extends MusicBeatSubstate
levelInfo.updateHitbox();
add(levelInfo);
var levelDifficulty:FlxText = new FlxText(20, 15 + 32, 0, PlayState.difficulty, 32);
var levelDifficulty:FlxText = new FlxText(20, 15 + 32, 0, PlayState.difficulty.toUpperCase(), 32);
levelDifficulty.scrollFactor.set();
levelDifficulty.setFormat(Paths.font('vcr.ttf'), 32);
levelDifficulty.updateHitbox();
+23 -4
View File
@@ -1,5 +1,6 @@
package funkin.menus;
import flixel.util.FlxTimer;
import flixel.math.FlxPoint;
import funkin.system.XMLUtil;
import flixel.graphics.frames.FlxFramesCollection;
@@ -141,8 +142,8 @@ class StoryMenuState extends MusicBeatState {
changeDifficulty((controls.LEFT_P ? -1 : 0) + (controls.RIGHT_P ? 1 : 0));
changeWeek((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0));
if (controls.ACCEPT) {
}
if (controls.ACCEPT)
selectWeek();
} else {
for(e in [leftArrow, rightArrow])
e.animation.play('idle');
@@ -186,9 +187,9 @@ class StoryMenuState extends MusicBeatState {
FlxTween.tween(diffSprite, {y: leftArrow.y, alpha: 1}, 0.07);
}
intendedScore = Highscore.getWeekScore(weeks[curWeek].name, weeks[curWeek].difficulties[curDifficulty]).score;
}
intendedScore = Highscore.getWeekScore(weeks[curWeek].name, weeks[curWeek].difficulties[curDifficulty]).score;
}
public function loadXMLs() {
@@ -202,6 +203,24 @@ class StoryMenuState extends MusicBeatState {
e.offset.put();
}
public function selectWeek() {
canSelect = false;
CoolUtil.playMenuSFX(1);
for(char in characterSprites)
if (char.animation.exists("confirm"))
char.animation.play("confirm");
CoolUtil.loadWeek(weeks[curWeek], weeks[curWeek].difficulties[curDifficulty]);
new FlxTimer().start(1, function(tmr:FlxTimer)
{
FlxG.switchState(new PlayState());
});
weekSprites.members[curWeek].startFlashing();
}
public function loadXML(xmlPath:String) {
try {
var xml = new Access(Xml.parse(Assets.getText(xmlPath)).firstElement());
+17
View File
@@ -1,5 +1,6 @@
package funkin.system;
import funkin.menus.StoryMenuState.WeekData;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.system.FlxAssets.FlxGraphicAsset;
import flixel.graphics.FlxGraphic;
@@ -225,6 +226,22 @@ class CoolUtil
}
}
public static function loadWeek(weekData:WeekData, difficulty:String = "normal") {
PlayState.storyWeek = weekData;
PlayState.storyPlaylist = [for(e in weekData.songs) e.name];
PlayState.isStoryMode = true;
PlayState.campaignScore = 0;
__loadSong(PlayState.storyPlaylist[0], difficulty);
}
public static function loadSong(name:String, difficulty:String = "normal") {
PlayState.campaignScore = 0;
PlayState.isStoryMode = false;
__loadSong(name, difficulty);
}
public static function __loadSong(name:String, difficulty:String) {
PlayState.difficulty = difficulty;
PlayState.SONG = Song.loadFromJson(name, difficulty);
}
public static function setSpriteSize(sprite:FlxSprite, width:Float, height:Float) {
sprite.scale.set(width / sprite.frameWidth, height / sprite.frameHeight);
sprite.updateHitbox();