Pyro test

This commit is contained in:
Eric Myllyoja 2022-02-28 23:04:55 -05:00
parent c995870bac
commit f2b4dbe751
6 changed files with 78 additions and 16 deletions

View file

@ -725,6 +725,8 @@ class Character extends FlxSprite
public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
{ {
if (animation == null)
return;
animation.play(AnimName, Force, Reversed, Frame); animation.play(AnimName, Force, Reversed, Frame);
var daOffset = animOffsets.get(AnimName); var daOffset = animOffsets.get(AnimName);

View file

@ -78,6 +78,7 @@ class FreeplayState extends MusicBeatSubstate
#if debug #if debug
isDebug = true; isDebug = true;
addSong('Test', 1, 'bf-pixel'); addSong('Test', 1, 'bf-pixel');
addSong('Pyro', 4, 'bf');
#end #end
var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
@ -517,10 +518,8 @@ class FreeplayState extends MusicBeatSubstate
if (controls.BACK) if (controls.BACK)
{ {
FlxG.sound.play(Paths.sound('cancelMenu')); FlxG.sound.play(Paths.sound('cancelMenu'));
// close();
close(); FlxG.switchState(new MainMenuState());
// FlxG.switchState(new MainMenuState());
} }
if (accepted) if (accepted)

View file

@ -117,6 +117,7 @@ class Note extends FlxSprite
var daStage:String = PlayState.curStageId; var daStage:String = PlayState.curStageId;
// TODO: Make this logic more generic
switch (daStage) switch (daStage)
{ {
case 'school' | 'schoolEvil': case 'school' | 'schoolEvil':
@ -288,18 +289,20 @@ typedef RawNoteData =
var noteData:NoteType; var noteData:NoteType;
var sustainLength:Float; var sustainLength:Float;
var altNote:Bool; var altNote:Bool;
var noteKind:NoteKind;
} }
@:forward @:forward
abstract NoteData(RawNoteData) abstract NoteData(RawNoteData)
{ {
public function new(strumTime = 0.0, noteData:NoteType = 0, sustainLength = 0.0, altNote = false) public function new(strumTime = 0.0, noteData:NoteType = 0, sustainLength = 0.0, altNote = false, noteKind = NORMAL)
{ {
this = { this = {
strumTime: strumTime, strumTime: strumTime,
noteData: noteData, noteData: noteData,
sustainLength: sustainLength, sustainLength: sustainLength,
altNote: altNote altNote: altNote,
noteKind: noteKind
} }
} }
@ -456,3 +459,13 @@ enum abstract NoteColor(NoteType) from Int to Int from NoteType
} }
} }
} }
enum abstract NoteKind(String) from String to String
{
var NORMAL = "normal";
var PYRO_LIGHT = "pyro_light";
var PYRO_KICK = "pyro_kick";
var PYRO_TOSS = "pyro_toss";
var PYRO_COCK = "pyro_cock"; // lol
var PYRO_SHOOT = "pyro_shoot";
}

View file

@ -84,7 +84,9 @@ class PlayState extends MusicBeatState
private var curSong:String = ""; private var curSong:String = "";
private var gfSpeed:Int = 1; private var gfSpeed:Int = 1;
private var health:Float = 1;
public static var health:Float = 1;
private var healthDisplay:Float = 1; private var healthDisplay:Float = 1;
private var combo:Int = 0; private var combo:Int = 0;
@ -156,6 +158,9 @@ class PlayState extends MusicBeatState
{ {
initCameras(); initCameras();
// Starting health.
health = 1;
persistentUpdate = true; persistentUpdate = true;
persistentDraw = true; persistentDraw = true;
@ -171,11 +176,11 @@ class PlayState extends MusicBeatState
switch (SONG.song.toLowerCase()) switch (SONG.song.toLowerCase())
{ {
case 'senpai': case 'senpai':
dialogue = CoolUtil.coolTextFile(Paths.txt('senpai/senpaiDialogue')); dialogue = CoolUtil.coolTextFile(Paths.txt('songs/senpai/senpaiDialogue'));
case 'roses': case 'roses':
dialogue = CoolUtil.coolTextFile(Paths.txt('roses/rosesDialogue')); dialogue = CoolUtil.coolTextFile(Paths.txt('songs/roses/rosesDialogue'));
case 'thorns': case 'thorns':
dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); dialogue = CoolUtil.coolTextFile(Paths.txt('songs/thorns/thornsDialogue'));
} }
#if discord_rpc #if discord_rpc
@ -400,6 +405,10 @@ class PlayState extends MusicBeatState
curStageId = 'mallEvil'; curStageId = 'mallEvil';
loadStage(curStageId); loadStage(curStageId);
case 'pyro':
curStageId = 'pyro';
loadStage(curStageId);
case 'senpai' | 'roses': case 'senpai' | 'roses':
curStageId = 'school'; curStageId = 'school';
@ -1348,10 +1357,17 @@ class PlayState extends MusicBeatState
gf.dance(); gf.dance();
if (swagCounter % 2 == 0) if (swagCounter % 2 == 0)
{ {
if (!boyfriend.animation.curAnim.name.startsWith("sing")) if (boyfriend.animation != null)
boyfriend.playAnim('idle'); {
if (!dad.animation.curAnim.name.startsWith("sing")) if (!boyfriend.animation.curAnim.name.startsWith("sing"))
dad.dance(); boyfriend.playAnim('idle');
}
if (dad.animation != null)
{
if (!dad.animation.curAnim.name.startsWith("sing"))
dad.dance();
}
} }
else if (dad.curCharacter == 'spooky' && !dad.animation.curAnim.name.startsWith("sing")) else if (dad.curCharacter == 'spooky' && !dad.animation.curAnim.name.startsWith("sing"))
dad.dance(); dad.dance();
@ -1510,8 +1526,9 @@ class PlayState extends MusicBeatState
oldNote = null; oldNote = null;
var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote); var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote);
swagNote.data.sustainLength = songNotes.sustainLength; swagNote.data = songNotes;
swagNote.data.altNote = songNotes.altNote; // swagNote.data.sustainLength = songNotes.sustainLength;
// swagNote.data.altNote = songNotes.altNote;
swagNote.scrollFactor.set(0, 0); swagNote.scrollFactor.set(0, 0);
var susLength:Float = swagNote.data.sustainLength; var susLength:Float = swagNote.data.sustainLength;
@ -2127,8 +2144,13 @@ class PlayState extends MusicBeatState
} }
else if (daNote.tooLate || daNote.wasGoodHit) else if (daNote.tooLate || daNote.wasGoodHit)
{ {
// TODO: Why the hell is the noteMiss logic in two different places?
if (daNote.tooLate) if (daNote.tooLate)
{ {
if (curStage != null)
{
curStage.onNoteMiss(daNote);
}
health -= 0.0775; health -= 0.0775;
vocals.volume = 0; vocals.volume = 0;
killCombo(); killCombo();
@ -2341,6 +2363,12 @@ class PlayState extends MusicBeatState
health += healthMulti; health += healthMulti;
// TODO: Redo note hit logic to make sure this always gets called
if (curStage != null)
{
curStage.onNoteHit(daNote);
}
if (isSick) if (isSick)
{ {
var noteSplash:NoteSplash = grpNoteSplashes.recycle(NoteSplash); var noteSplash:NoteSplash = grpNoteSplashes.recycle(NoteSplash);

View file

@ -188,6 +188,10 @@ class SongLoad
noteStuff[sectionIndex].sectionNotes[noteIndex].noteData = arrayDipshit[1]; noteStuff[sectionIndex].sectionNotes[noteIndex].noteData = arrayDipshit[1];
noteStuff[sectionIndex].sectionNotes[noteIndex].sustainLength = arrayDipshit[2]; noteStuff[sectionIndex].sectionNotes[noteIndex].sustainLength = arrayDipshit[2];
noteStuff[sectionIndex].sectionNotes[noteIndex].altNote = arrayDipshit[3]; noteStuff[sectionIndex].sectionNotes[noteIndex].altNote = arrayDipshit[3];
if (arrayDipshit.length >= 5)
{
noteStuff[sectionIndex].sectionNotes[noteIndex].noteKind = arrayDipshit[4];
}
} }
else if (noteDataArray != null) else if (noteDataArray != null)
{ {

View file

@ -188,6 +188,22 @@ class Stage extends FlxSpriteGroup implements IHook
// trace('Stage.onUpdate(${elapsed})'); // trace('Stage.onUpdate(${elapsed})');
} }
/**
* A function that gets called when the player hits a note.
*/
public function onNoteHit(note:Note):Void
{
// Override me in your scripted stage to perform custom behavior!
}
/**
* A function that gets called when the player hits a note.
*/
public function onNoteMiss(note:Note):Void
{
// Override me in your scripted stage to perform custom behavior!
}
/** /**
* Adjusts the position and other properties of the soon-to-be child of this sprite group. * Adjusts the position and other properties of the soon-to-be child of this sprite group.
* Private helper to avoid duplicate code in `add()` and `insert()`. * Private helper to avoid duplicate code in `add()` and `insert()`.