1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-27 01:03:35 +00:00

story mode type shit

This commit is contained in:
Cameron Taylor 2020-10-30 18:55:09 -07:00
parent c36e13722e
commit c76268fa3f
4 changed files with 84 additions and 23 deletions

View file

@ -17,6 +17,7 @@ class MenuCharacter extends FlxSprite
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);

View file

@ -8,6 +8,7 @@ import flixel.math.FlxMath;
class MenuItem extends FlxSpriteGroup
{
public var targetY:Float = 0;
public var week:FlxSprite;
public function new(x:Float, y:Float, weekNum:Int = 0, unlocked:Bool = false)
{
@ -15,13 +16,14 @@ class MenuItem extends FlxSpriteGroup
var tex = FlxAtlasFrames.fromSparrow(AssetPaths.campaign_menu_UI_assets__png, AssetPaths.campaign_menu_UI_assets__xml);
var week:FlxSprite = new FlxSprite();
week = new FlxSprite();
week.frames = tex;
week.animation.addByPrefix('week0', "WEEK1 select", 24);
week.animation.addByPrefix('week1', "week2 select", 24);
add(week);
week.animation.play('week' + weekNum);
week.animation.pause();
week.updateHitbox();
if (!unlocked)

View file

@ -35,6 +35,8 @@ class PlayState extends MusicBeatState
{
public static var curLevel:String = 'Bopeebo';
public static var SONG:SwagSong;
public static var isStoryMode:Bool = false;
public static var storyPlaylist:Array<String> = [];
private var vocals:FlxSound;
@ -278,7 +280,8 @@ class PlayState extends MusicBeatState
lastReportedPlayheadPosition = 0;
startingSong = false;
FlxG.sound.playMusic("assets/music/" + SONG.song + "_Inst" + TitleState.soundExt);
FlxG.sound.playMusic("assets/music/" + SONG.song + "_Inst" + TitleState.soundExt, 1, false);
FlxG.sound.music.onComplete = endSong;
vocals.play();
}
@ -606,9 +609,9 @@ class PlayState extends MusicBeatState
case 112:
gfSpeed = 1;
case 163:
FlxG.sound.music.stop();
curLevel = 'Bopeebo';
FlxG.switchState(new TitleState());
// FlxG.sound.music.stop();
// curLevel = 'Bopeebo';
// FlxG.switchState(new TitleState());
}
}
@ -617,9 +620,9 @@ class PlayState extends MusicBeatState
switch (totalBeats)
{
case 127:
FlxG.sound.music.stop();
curLevel = 'Fresh';
FlxG.switchState(new PlayState());
// FlxG.sound.music.stop();
// curLevel = 'Fresh';
// FlxG.switchState(new PlayState());
}
}
// better streaming of shit
@ -714,6 +717,28 @@ class PlayState extends MusicBeatState
keyShit();
}
function endSong():Void
{
trace('SONG DONE' + isStoryMode);
if (isStoryMode)
{
storyPlaylist.remove(storyPlaylist[0]);
if (storyPlaylist.length <= 0)
{
FlxG.switchState(new TitleState());
}
else
{
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase());
FlxG.switchState(new PlayState());
}
}
}
var endingSong:Bool = false;
private function popUpScore(strumtime:Float):Void
{
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
@ -1131,22 +1156,25 @@ class PlayState extends MusicBeatState
notes.sort(FlxSort.byY, FlxSort.DESCENDING);
}
FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
if (SONG.notes[Std.int(curStep / 16)].changeBPM)
if (SONG.notes[Math.floor(curStep / 16)] != null)
{
Conductor.changeBPM(SONG.notes[Std.int(curStep / 16)].bpm);
FlxG.log.add('CHANGED BPM!');
if (SONG.notes[Math.floor(curStep / 16)].changeBPM)
{
Conductor.changeBPM(SONG.notes[Math.floor(curStep / 16)].bpm);
FlxG.log.add('CHANGED BPM!');
}
else
Conductor.changeBPM(SONG.bpm);
// Dad doesnt interupt his own notes
if (SONG.notes[Math.floor(curStep / 16)].mustHitSection)
dad.dance();
}
else
Conductor.changeBPM(SONG.bpm);
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0)
FlxG.camera.zoom += 0.025;
// Dad doesnt interupt his own notes
if (SONG.notes[Std.int(curStep / 16)].mustHitSection)
dad.dance();
healthHeads.setGraphicSize(Std.int(healthHeads.width + 20));
if (totalBeats % gfSpeed == 0)

View file

@ -6,6 +6,7 @@ import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxGroup;
import flixel.text.FlxText;
import flixel.util.FlxTimer;
using StringTools;
@ -13,7 +14,7 @@ class StoryMenuState extends MusicBeatState
{
var scoreText:FlxText;
var weekData:Array<Dynamic> = [['Tutorial', 'Bopeebo', 'Fresh', 'Dad Battle'], ['Spookeez', 'South', 'Monster']];
var weekData:Array<Dynamic> = [['Tutorial', 'Bopeebo', 'Fresh', 'Dadbattle'], ['Spookeez', 'South', 'Monster']];
var weekUnlocked:Array<Bool> = [true, false];
var weekCharacters:Array<Dynamic> = [['dad', 'bf', 'gf'], ['spooky', 'bf', 'gf']];
var curWeek:Int = 0;
@ -151,14 +152,40 @@ class StoryMenuState extends MusicBeatState
lock.y = grpWeekText.members[lock.ID].y;
});
if (controls.UP_P)
changeWeek(-1);
if (controls.DOWN_P)
changeWeek(1);
if (!selectedWeek)
{
if (controls.UP_P)
changeWeek(-1);
if (controls.DOWN_P)
changeWeek(1);
}
if (controls.ACCEPT)
selectWeek();
super.update(elapsed);
}
var selectedWeek:Bool = false;
function selectWeek()
{
if (weekUnlocked[curWeek])
{
grpWeekText.members[curWeek].week.animation.resume();
grpWeekCharacters.members[1].animation.play('bfConfirm');
PlayState.storyPlaylist = weekData[curWeek];
PlayState.isStoryMode = true;
selectedWeek = true;
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase());
new FlxTimer().start(1, function(tmr:FlxTimer)
{
FlxG.switchState(new PlayState());
});
}
}
function changeWeek(change:Int = 0):Void
{
curWeek += change;
@ -181,6 +208,9 @@ class StoryMenuState extends MusicBeatState
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];