Add files via upload

This commit is contained in:
brightfyregit 2021-04-24 15:53:00 -06:00 committed by GitHub
parent fdc4c82fb5
commit abacebae2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 252 additions and 57 deletions

View File

@ -90,6 +90,9 @@ class ChartingState extends MusicBeatState
private var lastNote:Note; private var lastNote:Note;
var player1Icon:String;
var player2Icon:String;
override function create() override function create()
{ {
@ -98,20 +101,6 @@ class ChartingState extends MusicBeatState
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
add(gridBG); add(gridBG);
leftIcon = new HealthIcon('bf');
rightIcon = new HealthIcon('dad');
leftIcon.scrollFactor.set(1, 1);
rightIcon.scrollFactor.set(1, 1);
leftIcon.setGraphicSize(0, 45);
rightIcon.setGraphicSize(0, 45);
add(leftIcon);
add(rightIcon);
leftIcon.setPosition(0, -100);
rightIcon.setPosition(gridBG.width / 2, -100);
gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK);
add(gridBlackLine); add(gridBlackLine);
@ -134,6 +123,23 @@ class ChartingState extends MusicBeatState
}; };
} }
player1Icon = _song.player1;
player2Icon = _song.player2;
leftIcon = new HealthIcon(_song.player1);
rightIcon = new HealthIcon(_song.player2);
leftIcon.scrollFactor.set(1, 1);
rightIcon.scrollFactor.set(1, 1);
leftIcon.setGraphicSize(0, 45);
rightIcon.setGraphicSize(0, 45);
add(leftIcon);
add(rightIcon);
leftIcon.setPosition(0, -100);
rightIcon.setPosition(gridBG.width / 2, -100);
FlxG.mouse.visible = true; FlxG.mouse.visible = true;
FlxG.save.bind('funkin', 'ninjamuffin99'); FlxG.save.bind('funkin', 'ninjamuffin99');
@ -527,6 +533,8 @@ class ChartingState extends MusicBeatState
{ {
curStep = recalculateSteps(); curStep = recalculateSteps();
changeIcon();
if (FlxG.keys.justPressed.ALT && UI_box.selected_tab == 0) if (FlxG.keys.justPressed.ALT && UI_box.selected_tab == 0)
{ {
writingNotes = !writingNotes; writingNotes = !writingNotes;
@ -1119,6 +1127,38 @@ class ChartingState extends MusicBeatState
updateNoteUI(); updateNoteUI();
} }
function changeIcon():Void
{
if (_song.player1 != player1Icon)
{
remove(leftIcon);
player1Icon = _song.player1;
leftIcon = new HealthIcon(player1Icon);
leftIcon.scrollFactor.set(1, 1);
leftIcon.setGraphicSize(0, 45);
add(leftIcon);
leftIcon.setPosition(0, -100);
}
if (_song.player2 != player2Icon)
{
remove(rightIcon);
player2Icon = _song.player2;
rightIcon = new HealthIcon(player2Icon);
rightIcon.scrollFactor.set(1, 1);
rightIcon.setGraphicSize(0, 45);
add(rightIcon);
rightIcon.setPosition(gridBG.width / 2, -100);
}
}
function deleteNote(note:Note):Void function deleteNote(note:Note):Void
{ {

View File

@ -8,6 +8,9 @@ import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxMath; import flixel.math.FlxMath;
import flixel.text.FlxText; import flixel.text.FlxText;
import flixel.util.FlxColor; import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import lime.utils.Assets; import lime.utils.Assets;
@ -35,6 +38,8 @@ class FreeplayState extends MusicBeatState
private var iconArray:Array<HealthIcon> = []; private var iconArray:Array<HealthIcon> = [];
var bg:FlxSprite;
override function create() override function create()
{ {
var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
@ -68,7 +73,7 @@ class FreeplayState extends MusicBeatState
// LOAD CHARACTERS // LOAD CHARACTERS
var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuBGBlue')); bg = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
add(bg); add(bg);
grpSongs = new FlxTypedGroup<Alphabet>(); grpSongs = new FlxTypedGroup<Alphabet>();
@ -161,6 +166,8 @@ class FreeplayState extends MusicBeatState
} }
} }
var lockedIn:Bool = false;
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
super.update(elapsed); super.update(elapsed);
@ -206,6 +213,8 @@ class FreeplayState extends MusicBeatState
trace(poop); trace(poop);
lockedIn = true;
PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName.toLowerCase()); PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName.toLowerCase());
PlayState.isStoryMode = false; PlayState.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty; PlayState.storyDifficulty = curDifficulty;
@ -250,6 +259,7 @@ class FreeplayState extends MusicBeatState
curSelected += change; curSelected += change;
if (curSelected < 0) if (curSelected < 0)
curSelected = songs.length - 1; curSelected = songs.length - 1;
if (curSelected >= songs.length) if (curSelected >= songs.length)
@ -257,24 +267,57 @@ class FreeplayState extends MusicBeatState
// selector.y = (70 * curSelected) + 30; // selector.y = (70 * curSelected) + 30;
#if !switch
intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
// lerpScore = 0;
#end
#if PRELOAD_ALL
FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0);
#end
var bullShit:Int = 0;
for (i in 0...iconArray.length) for (i in 0...iconArray.length)
{ {
iconArray[i].alpha = 0.6; iconArray[i].alpha = 0.6;
} }
var bullShit:Int = 0;
iconArray[curSelected].alpha = 1; iconArray[curSelected].alpha = 1;
if (curSelected >= 0)
{
if (curSelected >= 4)
{
if (curSelected >= 7)
{
if (curSelected >= 10)
{
if (curSelected >= 13)
{
if (curSelected >= 16)
{
FlxTween.color(bg, 0.5, bg.color, FlxColor.fromRGB(219, 101, 217));
}
else
{
FlxTween.color(bg, 0.5, bg.color, FlxColor.fromRGB(161, 212, 230));
}
}
else
{
FlxTween.color(bg, 0.5, bg.color, FlxColor.fromRGB(230, 129, 221));
}
}
else
{
FlxTween.color(bg, 0.5, bg.color, FlxColor.fromRGB(99, 12, 22));
}
}
else
{
FlxTween.color(bg, 0.5, bg.color, FlxColor.fromRGB(39, 46, 66));
}
}
else
{
FlxTween.color(bg, 0.5, bg.color, FlxColor.fromRGB(96, 66, 245));
}
}
for (item in grpSongs.members) for (item in grpSongs.members)
{ {
item.targetY = bullShit - curSelected; item.targetY = bullShit - curSelected;
@ -289,6 +332,23 @@ class FreeplayState extends MusicBeatState
// item.setGraphicSize(Std.int(item.width)); // item.setGraphicSize(Std.int(item.width));
} }
} }
var temp:Int = curSelected;
new FlxTimer().start(FlxG.random.float(0.7), function(tmr:FlxTimer)
{
if (curSelected == temp && !lockedIn)
{
#if !switch
intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
// lerpScore = 0;
#end
#if PRELOAD_ALL
FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0);
#end
}
});
} }
} }

View File

@ -74,6 +74,27 @@ using StringTools;
class PlayState extends MusicBeatState class PlayState extends MusicBeatState
{ {
var characterCol:Array<String> = CoolUtil.coolTextFile(Paths.txt('characterList'));
var col:Array<FlxColor> = [
0xFF51d8fb, // BF
0xFFc885e5, // DAD
0xFFca1f6f, // GF
0xFFf9a326, // SPOOKY
0xFFceec75, // PICO
0xFFec7aac, // MOM
0xFFec7aac, // MOM-CAR
0xFF51d8fb, // BF-CAR
0xFFffffff, // PARENTS-CHRISTMAS
0xFFf5ff8a, // MONSTER-CHRISTMAS
0xFF51d8fb, // BF-CHRISTMAS
0xFFca1f6f, // GF-CHRISTMAS
0xFFf5ff8a, // MONSTER
0xFF9fe6ff, // BF-PIXEL
0xFFffaa6f, // SENPAI
0xFFffaa6f, // SENPAI-ANGRY
0xFFff5d87 // SPIRIT
];
public static var curStage:String = ''; public static var curStage:String = '';
public static var SONG:SwagSong; public static var SONG:SwagSong;
public static var isStoryMode:Bool = false; public static var isStoryMode:Bool = false;
@ -125,6 +146,9 @@ class PlayState extends MusicBeatState
private var strumLineNotes:FlxTypedGroup<FlxSprite>; private var strumLineNotes:FlxTypedGroup<FlxSprite>;
private var playerStrums:FlxTypedGroup<FlxSprite>; private var playerStrums:FlxTypedGroup<FlxSprite>;
private var player2Strums:FlxTypedGroup<FlxSprite>;
private var strumming2:Array<Bool> = [false, false, false, false];
private var camZooming:Bool = false; private var camZooming:Bool = false;
private var curSong:String = ""; private var curSong:String = "";
@ -998,6 +1022,7 @@ class PlayState extends MusicBeatState
add(strumLineNotes); add(strumLineNotes);
playerStrums = new FlxTypedGroup<FlxSprite>(); playerStrums = new FlxTypedGroup<FlxSprite>();
player2Strums = new FlxTypedGroup<FlxSprite>();
// startCountdown(); // startCountdown();
@ -1050,6 +1075,7 @@ class PlayState extends MusicBeatState
songName.cameras = [camHUD]; songName.cameras = [camHUD];
} }
healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('healthBar')); healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('healthBar'));
if (FlxG.save.data.downscroll) if (FlxG.save.data.downscroll)
healthBarBG.y = 50; healthBarBG.y = 50;
@ -1060,10 +1086,15 @@ class PlayState extends MusicBeatState
healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this, healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this,
'health', 0, 2); 'health', 0, 2);
healthBar.scrollFactor.set(); healthBar.scrollFactor.set();
healthBar.createFilledBar(0xFFFF0000, 0xFF66FF33); var curcol:FlxColor = col[characterCol.indexOf(dad.curCharacter)]; // Dad Icon
var curcol2:FlxColor = col[characterCol.indexOf(boyfriend.curCharacter)]; // Bf Icon
healthBar.createFilledBar(curcol, curcol2); // Use those colors
// healthBar // healthBar
add(healthBar); add(healthBar);
// Add Kade Engine watermark // Add Kade Engine watermark
kadeEngineWatermark = new FlxText(4,healthBarBG.y + 50,0,SONG.song + " " + (storyDifficulty == 2 ? "Hard" : storyDifficulty == 1 ? "Normal" : "Easy") + (Main.watermarks ? " - KE " + MainMenuState.kadeEngineVer : ""), 16); kadeEngineWatermark = new FlxText(4,healthBarBG.y + 50,0,SONG.song + " " + (storyDifficulty == 2 ? "Hard" : storyDifficulty == 1 ? "Normal" : "Easy") + (Main.watermarks ? " - KE " + MainMenuState.kadeEngineVer : ""), 16);
kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
@ -2031,6 +2062,10 @@ class PlayState extends MusicBeatState
{ {
playerStrums.add(babyArrow); playerStrums.add(babyArrow);
} }
else
{
player2Strums.add(babyArrow);
}
babyArrow.animation.play('static'); babyArrow.animation.play('static');
babyArrow.x += 50; babyArrow.x += 50;
@ -2621,6 +2656,15 @@ class PlayState extends MusicBeatState
dad.playAnim('singLEFT' + altAnim, true); dad.playAnim('singLEFT' + altAnim, true);
} }
player2Strums.forEach(function(spr:FlxSprite)
{
if (Math.abs(daNote.noteData) == spr.ID)
{
spr.animation.play('confirm');
sustainplayer2(spr.ID, spr, daNote);
}
});
#if cpp #if cpp
if (lua != null) if (lua != null)
callLua('playerTwoSing', [Math.abs(daNote.noteData), Conductor.songPosition]); callLua('playerTwoSing', [Math.abs(daNote.noteData), Conductor.songPosition]);
@ -2638,6 +2682,23 @@ class PlayState extends MusicBeatState
daNote.destroy(); daNote.destroy();
} }
player2Strums.forEach(function(spr:FlxSprite)
{
if (strumming2[spr.ID])
{
spr.animation.play("confirm");
}
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
{
spr.centerOffsets();
spr.offset.x -= 13;
spr.offset.y -= 13;
}
else
spr.centerOffsets();
});
if (!daNote.modifiedByLua) if (!daNote.modifiedByLua)
{ {
if (FlxG.save.data.downscroll) if (FlxG.save.data.downscroll)
@ -2710,6 +2771,34 @@ class PlayState extends MusicBeatState
#end #end
} }
function sustainplayer2(strum:Int, spr:FlxSprite, note:Note):Void
{
var length:Float = note.sustainLength;
var tempo:Float = Conductor.bpm / 60;
var temp:Float = 1 / tempo;
if (length > 0)
{
strumming2[strum] = true;
}
if (!note.isSustainNote)
{
new FlxTimer().start(length == 0 ? 0.2 : (length / Conductor.crochet * temp) + 0.1, function(tmr:FlxTimer)
{
if (!strumming2[strum])
{
spr.animation.play("static", true);
}
else if (length > 0)
{
strumming2[strum] = false;
spr.animation.play("static", true);
}
});
}
}
function endSong():Void function endSong():Void
{ {
if (!loadRep) if (!loadRep)
@ -3881,17 +3970,19 @@ class PlayState extends MusicBeatState
// Conductor.changeBPM(SONG.bpm); // Conductor.changeBPM(SONG.bpm);
// Dad doesnt interupt his own notes // Dad doesnt interupt his own notes
// Commented out until a reason to bring this back arises in the future
/* if (SONG.notes[Math.floor(curStep / 16)].mustHitSection)
dad.dance(); */
if (dad.animation.curAnim.name.startsWith('sing')) if (dad.animation.curAnim.name.startsWith('sing'))
{
if (dad.animation.finished) if (dad.animation.finished)
{
dad.dance(); dad.dance();
}
}
else else
{
dad.dance(); dad.dance();
} }
}
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
wiggleShit.update(Conductor.crochet); wiggleShit.update(Conductor.crochet);

View File

@ -305,6 +305,10 @@ class StoryMenuState extends MusicBeatState
LoadingState.loadAndSwitchState(new PlayState(), true); LoadingState.loadAndSwitchState(new PlayState(), true);
}); });
} }
else
{
FlxG.camera.shake(0.02, 0.02);
}
} }
function changeDifficulty(change:Int = 0):Void function changeDifficulty(change:Int = 0):Void