1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-03-22 01:49:21 +00:00

cool new stuff lol

This commit is contained in:
Cameron Taylor 2020-10-18 17:59:53 -07:00
parent 912596111b
commit 84f54eae67
10 changed files with 173 additions and 115 deletions

View file

@ -12,10 +12,10 @@ import flixel.util.FlxColor;
/** /**
*DEBUG MODE *DEBUG MODE
*/ */
class Charting extends FlxState class AnimationDebug extends FlxState
{ {
var bf:Boyfriend; var bf:Boyfriend;
var dad:Dad; var dad:Character;
var char:Character; var char:Character;
var textAnim:FlxText; var textAnim:FlxText;
var dumbTexts:FlxTypedGroup<FlxText>; var dumbTexts:FlxTypedGroup<FlxText>;
@ -40,7 +40,7 @@ class Charting extends FlxState
if (isDad) if (isDad)
{ {
dad = new Dad(0, 0); dad = new Character(0, 0);
dad.screenCenter(); dad.screenCenter();
dad.debugMode = true; dad.debugMode = true;
add(dad); add(dad);

View file

@ -1,16 +1,93 @@
package; package;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
class Character extends FlxSprite class Character extends FlxSprite
{ {
public var animOffsets:Map<String, Array<Dynamic>>; public var animOffsets:Map<String, Array<Dynamic>>;
public var debugMode:Bool = false; public var debugMode:Bool = false;
public function new(x:Float, y:Float) public var isPlayer:Bool = false;
public var curCharacter:String = 'bf';
public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false)
{ {
animOffsets = new Map<String, Array<Dynamic>>(); animOffsets = new Map<String, Array<Dynamic>>();
super(x, y); super(x, y);
curCharacter = character;
this.isPlayer = isPlayer;
var tex:FlxAtlasFrames;
antialiasing = true;
switch (curCharacter)
{
case 'bf':
case 'gf':
// GIRLFRIEND CODE
tex = FlxAtlasFrames.fromSparrow(AssetPaths.GF_assets__png, AssetPaths.GF_assets__xml);
frames = tex;
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
animation.addByPrefix('singRIGHT', 'GF Right Note', 24, false);
animation.addByPrefix('singUP', 'GF Up Note', 24, false);
animation.addByPrefix('singDOWN', 'GF Down Note', 24, false);
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, false);
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
addOffset('cheer');
addOffset('sad');
addOffset('danceLeft');
addOffset('danceRight');
addOffset("singUP");
addOffset("singRIGHT");
addOffset("singLEFT");
addOffset("singDOWN");
playAnim('danceRight');
case 'dad':
// DAD ANIMATION LOADING CODE
tex = FlxAtlasFrames.fromSparrow(AssetPaths.DADDY_DEAREST__png, AssetPaths.DADDY_DEAREST__xml);
frames = tex;
animation.addByPrefix('idle', 'Dad idle dance', 24);
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
animation.addByPrefix('singRIGHT', 'Dad Sing Note RIGHT', 24);
animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24);
animation.addByPrefix('singLEFT', 'Dad Sing Note LEFT', 24);
playAnim('idle');
addOffset('idle');
addOffset("singUP", -6, 50);
addOffset("singRIGHT", 0, 27);
addOffset("singLEFT", -10, 10);
addOffset("singDOWN", 0, -30);
}
}
private var danced:Bool = false;
/**
* FOR GF DANCING SHIT
*/
public function dance()
{
switch (curCharacter)
{
case 'gf':
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
case 'dad':
playAnim('idle');
}
} }
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

View file

@ -7,6 +7,7 @@ import flixel.addons.ui.FlxInputText;
import flixel.addons.ui.FlxUI9SliceSprite; import flixel.addons.ui.FlxUI9SliceSprite;
import flixel.addons.ui.FlxUI; import flixel.addons.ui.FlxUI;
import flixel.addons.ui.FlxUICheckBox; import flixel.addons.ui.FlxUICheckBox;
import flixel.addons.ui.FlxUIDropDownMenu;
import flixel.addons.ui.FlxUIInputText; import flixel.addons.ui.FlxUIInputText;
import flixel.addons.ui.FlxUINumericStepper; import flixel.addons.ui.FlxUINumericStepper;
import flixel.addons.ui.FlxUITabMenu; import flixel.addons.ui.FlxUITabMenu;
@ -60,6 +61,7 @@ class ChartingState extends MusicBeatState
var _song:Song; var _song:Song;
var typingShit:FlxInputText; var typingShit:FlxInputText;
var curSelectedNote:Note = new Note(0, 0, null);
override function create() override function create()
{ {
@ -152,6 +154,21 @@ class ChartingState extends MusicBeatState
stepperBPM.value = Conductor.bpm; stepperBPM.value = Conductor.bpm;
stepperBPM.name = 'song_bpm'; stepperBPM.name = 'song_bpm';
var characters:Array<String> = ["bf", 'dad', 'gf'];
var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
{
_song.player1 = characters[Std.parseInt(character)];
});
player1DropDown.selectedLabel = _song.player1;
var player2DropDown = new FlxUIDropDownMenu(140, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
{
_song.player2 = characters[Std.parseInt(character)];
});
player2DropDown.selectedLabel = _song.player2;
var tab_group_song = new FlxUI(null, UI_box); var tab_group_song = new FlxUI(null, UI_box);
tab_group_song.name = "Song"; tab_group_song.name = "Song";
tab_group_song.add(UI_songTitle); tab_group_song.add(UI_songTitle);
@ -162,6 +179,8 @@ class ChartingState extends MusicBeatState
tab_group_song.add(reloadSongJson); tab_group_song.add(reloadSongJson);
tab_group_song.add(stepperBPM); tab_group_song.add(stepperBPM);
tab_group_song.add(stepperSpeed); tab_group_song.add(stepperSpeed);
tab_group_song.add(player1DropDown);
tab_group_song.add(player2DropDown);
UI_box.addGroup(tab_group_song); UI_box.addGroup(tab_group_song);
UI_box.scrollFactor.set(); UI_box.scrollFactor.set();
@ -422,12 +441,9 @@ class ChartingState extends MusicBeatState
{ {
var daSec = FlxMath.maxInt(curSection, sectionNum); var daSec = FlxMath.maxInt(curSection, sectionNum);
for (note in _song.notes[daSec - sectionNum].notes) for (note in _song.notes[daSec - sectionNum].sectionNotes)
{ {
_song.notes[daSec].notes.push([ _song.notes[daSec].sectionNotes.push(note);
note[0] + Conductor.stepCrochet * (_song.notes[daSec].lengthInSteps * sectionNum),
note[1]
]);
} }
updateGrid(); updateGrid();
@ -448,7 +464,7 @@ class ChartingState extends MusicBeatState
curRenderedNotes.remove(curRenderedNotes.members[0], true); curRenderedNotes.remove(curRenderedNotes.members[0], true);
} }
var sectionInfo:Array<Dynamic> = _song.notes[curSection].notes; var sectionInfo:Array<Dynamic> = _song.notes[curSection].sectionNotes;
for (i in sectionInfo) for (i in sectionInfo)
{ {
@ -471,12 +487,12 @@ class ChartingState extends MusicBeatState
function deleteNote(note:Note):Void function deleteNote(note:Note):Void
{ {
for (i in _song.notes[curSection].notes) for (i in _song.notes[curSection].sectionNotes)
{ {
if (i[0] == note.strumTime && i[1] % 4 == note.noteData) if (i.strumTime == note.strumTime && i.noteData % 4 == note.noteData)
{ {
FlxG.log.add('FOUND EVIL NUMBER'); FlxG.log.add('FOUND EVIL NUMBER');
_song.notes[curSection].notes.remove(i); _song.notes[curSection].sectionNotes.remove(i);
} }
} }
@ -485,10 +501,10 @@ class ChartingState extends MusicBeatState
private function addNote():Void private function addNote():Void
{ {
_song.notes[curSection].notes.push([ var swagNote:Note = new Note(Math.round(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16))),
Math.round(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16))), Math.floor(FlxG.mouse.x / GRID_SIZE));
Math.floor(FlxG.mouse.x / GRID_SIZE)
]); _song.notes[curSection].sectionNotes.push(swagNote);
trace(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16))); trace(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16)));
trace(curSection); trace(curSection);
@ -542,7 +558,7 @@ class ChartingState extends MusicBeatState
for (i in _song.notes) for (i in _song.notes)
{ {
noteData.push(i.notes); noteData.push(i.sectionNotes);
} }
return noteData; return noteData;

View file

@ -12,10 +12,12 @@ class Conductor
public static var songPosition:Float; public static var songPosition:Float;
public static var offset:Float = 0; public static var offset:Float = 0;
public static var safeFrames:Int = 5; public static var safeFrames:Int = 10;
public static var safeZoneOffset:Float = (safeFrames / 60) * 1000; // is calculated in create(), is safeFrames in milliseconds public static var safeZoneOffset:Float = (safeFrames / 60) * 1000; // is calculated in create(), is safeFrames in milliseconds
public function new() {} public function new()
{
}
public static function changeBPM(newBpm:Int) public static function changeBPM(newBpm:Int)
{ {

View file

@ -1,26 +0,0 @@
package;
import flixel.graphics.frames.FlxAtlasFrames;
class Dad extends Character
{
public function new(x:Float, y:Float)
{
super(x, y);
var dadTex = FlxAtlasFrames.fromSparrow(AssetPaths.DADDY_DEAREST__png, AssetPaths.DADDY_DEAREST__xml);
frames = dadTex;
antialiasing = true;
animation.addByPrefix('idle', 'Dad idle dance', 24);
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
animation.addByPrefix('singRIGHT', 'Dad Sing Note RIGHT', 24);
animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24);
animation.addByPrefix('singLEFT', 'Dad Sing Note LEFT', 24);
playAnim('idle');
addOffset('idle');
addOffset("singUP", -6, 50);
addOffset("singRIGHT", 0, 27);
addOffset("singLEFT", -10, 10);
addOffset("singDOWN", 0, -30);
}
}

View file

@ -1,37 +0,0 @@
package;
import flixel.graphics.frames.FlxAtlasFrames;
class Girlfriend extends Character
{
public function new(x:Float, y:Float)
{
super(x, y);
var tex = FlxAtlasFrames.fromSparrow(AssetPaths.GF_assets__png, AssetPaths.GF_assets__xml);
frames = tex;
animation.addByPrefix('cheer', 'GF Cheer');
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, false);
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
addOffset('cheer');
addOffset('sad');
addOffset('danceLeft');
addOffset('danceRight');
playAnim('danceRight');
}
private var danced:Bool = false;
public function dance()
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
}

View file

@ -15,6 +15,8 @@ class Note extends FlxSprite
public var wasGoodHit:Bool = false; public var wasGoodHit:Bool = false;
public var prevNote:Note; public var prevNote:Note;
public var sustainLength:Float = 0;
public var noteScore:Float = 1; public var noteScore:Float = 1;
public static var swagWidth:Float = 160 * 0.7; public static var swagWidth:Float = 160 * 0.7;

View file

@ -33,8 +33,8 @@ class PlayState extends MusicBeatState
private var vocals:FlxSound; private var vocals:FlxSound;
private var dad:Dad; private var dad:Character;
private var gf:Girlfriend; private var gf:Character;
private var boyfriend:Boyfriend; private var boyfriend:Boyfriend;
private var notes:FlxTypedGroup<Note>; private var notes:FlxTypedGroup<Note>;
@ -96,14 +96,20 @@ class PlayState extends MusicBeatState
stageCurtains.scrollFactor.set(1.3, 1.3); stageCurtains.scrollFactor.set(1.3, 1.3);
stageCurtains.active = false; stageCurtains.active = false;
gf = new Girlfriend(400, 130); gf = new Character(400, 130, 'gf');
gf.scrollFactor.set(0.95, 0.95); gf.scrollFactor.set(0.95, 0.95);
gf.antialiasing = true; gf.antialiasing = true;
add(gf); add(gf);
dad = new Dad(100, 100); dad = new Character(100, 100, SONG.player2);
add(dad); add(dad);
if (SONG.player2 == 'gf')
{
dad.setPosition(gf.x, gf.y);
gf.visible = false;
}
boyfriend = new Boyfriend(770, 450); boyfriend = new Boyfriend(770, 450);
add(boyfriend); add(boyfriend);
@ -263,7 +269,7 @@ class PlayState extends MusicBeatState
{ {
var coolSection:Int = Std.int(section.lengthInSteps / 4); var coolSection:Int = Std.int(section.lengthInSteps / 4);
for (songNotes in section.notes) for (songNotes in section.sectionNotes)
{ {
sectionScores[0].push(0); sectionScores[0].push(0);
sectionScores[1].push(0); sectionScores[1].push(0);
@ -454,12 +460,11 @@ class PlayState extends MusicBeatState
healthHeads.animation.play('unhealthy'); healthHeads.animation.play('unhealthy');
else else
healthHeads.animation.play('healthy'); healthHeads.animation.play('healthy');
/*
if (FlxG.keys.justPressed.NINE) /* if (FlxG.keys.justPressed.NINE)
FlxG.switchState(new Charting()); FlxG.switchState(new Charting()); */
if (FlxG.keys.justPressed.EIGHT) if (FlxG.keys.justPressed.EIGHT)
FlxG.switchState(new Charting(true)); FlxG.switchState(new AnimationDebug(true));
*/
if (countingDown) if (countingDown)
{ {
@ -477,7 +482,7 @@ class PlayState extends MusicBeatState
if (playerTurn == (sectionLengths[curSection] * 8) - 1 && !sectionScored) if (playerTurn == (sectionLengths[curSection] * 8) - 1 && !sectionScored)
{ {
popUpScore(); // popUpScore();
sectionScored = true; sectionScored = true;
} }
@ -488,15 +493,15 @@ class PlayState extends MusicBeatState
trace(PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection); trace(PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection);
} }
if (camFollow.x != dad.getGraphicMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection) if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection)
{ {
camFollow.setPosition(dad.getGraphicMidpoint().x + 150, dad.getGraphicMidpoint().y - 100); camFollow.setPosition(dad.getMidpoint().x + 150, dad.getMidpoint().y - 100);
vocals.volume = 1; vocals.volume = 1;
} }
if (PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection && camFollow.x != boyfriend.getGraphicMidpoint().x - 100) if (PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection && camFollow.x != boyfriend.getMidpoint().x - 100)
{ {
camFollow.setPosition(boyfriend.getGraphicMidpoint().x - 100, boyfriend.getGraphicMidpoint().y - 100); camFollow.setPosition(boyfriend.getMidpoint().x - 100, boyfriend.getMidpoint().y - 100);
} }
} }
@ -626,29 +631,47 @@ class PlayState extends MusicBeatState
keyShit(); keyShit();
} }
private function popUpScore():Void private function popUpScore(strumtime:Float):Void
{ {
boyfriend.playAnim('hey'); var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
vocals.volume = 1;
trace(noteDiff);
// boyfriend.playAnim('hey');
// vocals.volume = 1;
var placement:String = Std.string(combo); var placement:String = Std.string(combo);
// var placement:String = sectionScores[1][curSection] + '/' + sectionScores[0][curSection]; // var placement:String = sectionScores[1][curSection] + '/' + sectionScores[0][curSection];
var coolText:FlxText = new FlxText(0, 0, 0, placement, 32); var coolText:FlxText = new FlxText(0, 0, 0, placement, 32);
coolText.screenCenter(); coolText.screenCenter();
coolText.x = FlxG.width * 0.75; coolText.x = FlxG.width * 0.55;
// //
var rating:FlxSprite = new FlxSprite(); var rating:FlxSprite = new FlxSprite();
var daRating:String = "shit"; var daRating:String = "sick";
if (combo > 60) if (noteDiff > Conductor.safeZoneOffset * 0.9)
daRating = 'sick'; {
else if (combo > 12) daRating = 'shit';
daRating = 'good' }
else if (combo > 4) else if (noteDiff > Conductor.safeZoneOffset * 0.75)
{
daRating = 'bad'; daRating = 'bad';
}
else if (noteDiff > Conductor.safeZoneOffset * 0.2)
{
daRating = 'good';
}
/* if (combo > 60)
daRating = 'sick';
else if (combo > 12)
daRating = 'good'
else if (combo > 4)
daRating = 'bad';
*/
rating.loadGraphic('assets/images/' + daRating + ".png"); rating.loadGraphic('assets/images/' + daRating + ".png");
rating.screenCenter(); rating.screenCenter();
rating.x = coolText.x - 40; rating.x = coolText.x - 40;
@ -669,7 +692,7 @@ class PlayState extends MusicBeatState
comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7)); comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7));
comboSpr.updateHitbox(); comboSpr.updateHitbox();
comboSpr.velocity.x += FlxG.random.int(1, 10); comboSpr.velocity.x += FlxG.random.int(1, 10);
add(comboSpr); // add(comboSpr);
add(rating); add(rating);
var seperatedScore:Array<Int> = []; var seperatedScore:Array<Int> = [];
@ -1017,6 +1040,7 @@ class PlayState extends MusicBeatState
{ {
if (!note.wasGoodHit) if (!note.wasGoodHit)
{ {
popUpScore(note.strumTime);
combo += 1; combo += 1;
if (note.noteData >= 0) if (note.noteData >= 0)
@ -1072,7 +1096,7 @@ class PlayState extends MusicBeatState
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0) if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0)
FlxG.camera.zoom += 0.025; FlxG.camera.zoom += 0.025;
dad.playAnim('idle'); dad.dance();
healthHeads.setGraphicSize(Std.int(healthHeads.width + 20)); healthHeads.setGraphicSize(Std.int(healthHeads.width + 20));
if (totalBeats % gfSpeed == 0) if (totalBeats % gfSpeed == 0)

View file

@ -2,10 +2,7 @@ package;
class Section class Section
{ {
/** public var sectionNotes:Array<Note> = [];
* NOT ACTUAL NOTE DATA! Just holds strum time and which part of the chart it is!
*/
public var notes:Array<Dynamic> = [];
public var lengthInSteps:Int = 16; public var lengthInSteps:Int = 16;
public var typeOfSection:Int = 0; public var typeOfSection:Int = 0;

View file

@ -15,6 +15,9 @@ class Song
public var needsVoices:Bool = true; public var needsVoices:Bool = true;
public var speed:Float = 1; public var speed:Float = 1;
public var player1:String = 'bf';
public var player2:String = 'dad';
public function new(song, notes, bpm, sections) public function new(song, notes, bpm, sections)
{ {
this.song = song; this.song = song;