mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-24 14:16:56 +00:00
dynamic camer, reformat chart, lvl2
This commit is contained in:
parent
411f3a802a
commit
ce5235a9ac
|
@ -20,16 +20,11 @@ class Boyfriend extends Character
|
||||||
animation.addByPrefix('hey', 'BF HEY', 24, false);
|
animation.addByPrefix('hey', 'BF HEY', 24, false);
|
||||||
playAnim('idle');
|
playAnim('idle');
|
||||||
|
|
||||||
addOffset('idle');
|
addOffset('idle', -5);
|
||||||
addOffset("singUP", -28, 27);
|
addOffset("singUP", -29, 27);
|
||||||
addOffset("singRIGHT", -38, -7);
|
addOffset("singRIGHT", -38, -7);
|
||||||
addOffset("singLEFT", 12, -6);
|
addOffset("singLEFT", 12, -6);
|
||||||
addOffset("singDOWN", -14, -50);
|
addOffset("singDOWN", -10, -50);
|
||||||
addOffset("hey", 1, 6);
|
addOffset("hey", 7, 4);
|
||||||
}
|
|
||||||
|
|
||||||
override function update(elapsed:Float)
|
|
||||||
{
|
|
||||||
super.update(elapsed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ class ChartParser
|
||||||
var IMG_WIDTH:Int = 8;
|
var IMG_WIDTH:Int = 8;
|
||||||
var regex:EReg = new EReg("[ \t]*((\r\n)|\r|\n)[ \t]*", "g");
|
var regex:EReg = new EReg("[ \t]*((\r\n)|\r|\n)[ \t]*", "g");
|
||||||
|
|
||||||
var csvData = FlxStringUtil.imageToCSV('assets/data/' + songName + '/section' + section + '.png');
|
var csvData = FlxStringUtil.imageToCSV('assets/data/' + songName + '/' + songName + '_section' + section + '.png');
|
||||||
|
|
||||||
var lines:Array<String> = regex.split(csvData);
|
var lines:Array<String> = regex.split(csvData);
|
||||||
var rows:Array<String> = lines.filter(function(line) return line != "");
|
var rows:Array<String> = lines.filter(function(line) return line != "");
|
||||||
|
|
|
@ -7,6 +7,7 @@ import flixel.FlxState;
|
||||||
import flixel.addons.display.FlxGridOverlay;
|
import flixel.addons.display.FlxGridOverlay;
|
||||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||||
import flixel.text.FlxText;
|
import flixel.text.FlxText;
|
||||||
|
import flixel.util.FlxColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*DEBUG MODE
|
*DEBUG MODE
|
||||||
|
@ -83,6 +84,7 @@ class Charting extends FlxState
|
||||||
{
|
{
|
||||||
var text:FlxText = new FlxText(10, 20 + (18 * daLoop), 0, anim + ": " + offsets, 15);
|
var text:FlxText = new FlxText(10, 20 + (18 * daLoop), 0, anim + ": " + offsets, 15);
|
||||||
text.scrollFactor.set();
|
text.scrollFactor.set();
|
||||||
|
text.color = FlxColor.BLUE;
|
||||||
dumbTexts.add(text);
|
dumbTexts.add(text);
|
||||||
|
|
||||||
if (pushList)
|
if (pushList)
|
||||||
|
|
|
@ -16,4 +16,12 @@ class Conductor
|
||||||
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)
|
||||||
|
{
|
||||||
|
bpm = newBpm;
|
||||||
|
|
||||||
|
crochet = ((60 / bpm) * 1000);
|
||||||
|
stepCrochet = crochet / 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,14 @@ class Dad extends Character
|
||||||
frames = dadTex;
|
frames = dadTex;
|
||||||
animation.addByPrefix('idle', 'Dad idle dance', 24);
|
animation.addByPrefix('idle', 'Dad idle dance', 24);
|
||||||
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
|
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
|
||||||
animation.addByPrefix('singRIGHT', 'Dad Sing Note UP', 24);
|
animation.addByPrefix('singRIGHT', 'Dad Sing Note RIGHT', 24);
|
||||||
animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24);
|
animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24);
|
||||||
animation.addByPrefix('singLEFT', 'Dad Sing Note RIGHT', 24);
|
animation.addByPrefix('singLEFT', 'Dad Sing Note LEFT', 24);
|
||||||
playAnim('idle');
|
playAnim('idle');
|
||||||
|
|
||||||
addOffset('idle');
|
addOffset('idle');
|
||||||
addOffset("singUP", -6, 50);
|
addOffset("singUP", -6, 50);
|
||||||
addOffset("singRIGHT", -6, 50);
|
addOffset("singRIGHT", 0, 27);
|
||||||
addOffset("singLEFT", -10, 10);
|
addOffset("singLEFT", -10, 10);
|
||||||
addOffset("singDOWN", 0, -30);
|
addOffset("singDOWN", 0, -30);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ class PlayState extends FlxState
|
||||||
private var curSection:Int = 0;
|
private var curSection:Int = 0;
|
||||||
|
|
||||||
private var sectionScores:Array<Dynamic> = [[], []];
|
private var sectionScores:Array<Dynamic> = [[], []];
|
||||||
|
private var sectionLengths:Array<Int> = [];
|
||||||
|
|
||||||
private var camFollow:FlxObject;
|
private var camFollow:FlxObject;
|
||||||
private var strumLineNotes:FlxTypedGroup<FlxSprite>;
|
private var strumLineNotes:FlxTypedGroup<FlxSprite>;
|
||||||
|
@ -68,7 +69,7 @@ class PlayState extends FlxState
|
||||||
|
|
||||||
playerStrums = new FlxTypedGroup<FlxSprite>();
|
playerStrums = new FlxTypedGroup<FlxSprite>();
|
||||||
|
|
||||||
generateSong('assets/data/bopeebo/bopeebo.json');
|
generateSong('assets/data/fresh/fresh.json');
|
||||||
|
|
||||||
canHitText = new FlxText(10, 10, 0, "weed");
|
canHitText = new FlxText(10, 10, 0, "weed");
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ class PlayState extends FlxState
|
||||||
generateStaticArrows(1);
|
generateStaticArrows(1);
|
||||||
|
|
||||||
var songData = Json.parse(Assets.getText(dataPath));
|
var songData = Json.parse(Assets.getText(dataPath));
|
||||||
|
Conductor.changeBPM(songData.bpm);
|
||||||
FlxG.sound.playMusic("assets/music/" + songData.song + "_Inst.mp3");
|
FlxG.sound.playMusic("assets/music/" + songData.song + "_Inst.mp3");
|
||||||
|
|
||||||
vocals = new FlxSound().loadEmbedded("assets/music/" + songData.song + "_Voices.mp3");
|
vocals = new FlxSound().loadEmbedded("assets/music/" + songData.song + "_Voices.mp3");
|
||||||
|
@ -119,21 +121,32 @@ class PlayState extends FlxState
|
||||||
while (playerCounter < 2)
|
while (playerCounter < 2)
|
||||||
{
|
{
|
||||||
var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped
|
var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped
|
||||||
|
var totalLength:Int = 0; // Total length of the song, in beats;
|
||||||
for (section in noteData)
|
for (section in noteData)
|
||||||
{
|
{
|
||||||
var dumbassSection:Array<Dynamic> = section;
|
var dumbassSection:Array<Dynamic> = section;
|
||||||
|
|
||||||
var daStep:Int = 0;
|
var daStep:Int = 0;
|
||||||
|
var coolSection:Int = Std.int(section.length / 4);
|
||||||
|
|
||||||
|
if (coolSection <= 4) // FIX SINCE MOST THE SHIT I MADE WERE ONLY 3 HTINGS LONG LOl
|
||||||
|
coolSection = 4;
|
||||||
|
else if (coolSection <= 8)
|
||||||
|
coolSection = 8;
|
||||||
|
|
||||||
for (songNotes in dumbassSection)
|
for (songNotes in dumbassSection)
|
||||||
{
|
{
|
||||||
sectionScores[0].push(0);
|
sectionScores[0].push(0);
|
||||||
sectionScores[1].push(0);
|
sectionScores[1].push(0);
|
||||||
|
|
||||||
|
trace('SECTON');
|
||||||
|
trace(daBeats);
|
||||||
|
trace(totalLength);
|
||||||
|
|
||||||
if (songNotes != 0)
|
if (songNotes != 0)
|
||||||
{
|
{
|
||||||
var daStrumTime:Float = (((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * daBeats))
|
var daStrumTime:Float = ((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * totalLength))
|
||||||
+ ((Conductor.crochet * 4) * playerCounter));
|
+ ((Conductor.crochet * coolSection) * playerCounter);
|
||||||
|
|
||||||
var swagNote:Note = new Note(daStrumTime, songNotes);
|
var swagNote:Note = new Note(daStrumTime, songNotes);
|
||||||
swagNote.scrollFactor.set(0, 0);
|
swagNote.scrollFactor.set(0, 0);
|
||||||
|
@ -160,11 +173,16 @@ class PlayState extends FlxState
|
||||||
daStep += 1;
|
daStep += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only need to do it once
|
||||||
|
if (playerCounter == 0)
|
||||||
|
sectionLengths.push(Math.round(coolSection / 4));
|
||||||
|
totalLength += Math.round(coolSection / 4);
|
||||||
daBeats += 1;
|
daBeats += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
playerCounter += 1;
|
playerCounter += 1;
|
||||||
}
|
}
|
||||||
|
trace(sectionLengths);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateStaticArrows(player:Int):Void
|
private function generateStaticArrows(player:Int):Void
|
||||||
|
@ -237,9 +255,9 @@ class PlayState extends FlxState
|
||||||
FlxG.switchState(new Charting(true));
|
FlxG.switchState(new Charting(true));
|
||||||
|
|
||||||
Conductor.songPosition = FlxG.sound.music.time;
|
Conductor.songPosition = FlxG.sound.music.time;
|
||||||
var playerTurn:Int = totalBeats % 8;
|
var playerTurn:Int = totalBeats % (sectionLengths[curSection] * 8);
|
||||||
|
|
||||||
if (playerTurn == 7 && !sectionScored)
|
if (playerTurn == (sectionLengths[curSection] * 8) - 1 && !sectionScored)
|
||||||
{
|
{
|
||||||
popUpScore();
|
popUpScore();
|
||||||
sectionScored = true;
|
sectionScored = true;
|
||||||
|
@ -251,7 +269,7 @@ class PlayState extends FlxState
|
||||||
vocals.volume = 1;
|
vocals.volume = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerTurn == 4)
|
if (playerTurn == Std.int((sectionLengths[curSection] * 8) / 2))
|
||||||
{
|
{
|
||||||
camFollow.setPosition(boyfriend.getGraphicMidpoint().x - 100, boyfriend.getGraphicMidpoint().y - 100);
|
camFollow.setPosition(boyfriend.getGraphicMidpoint().x - 100, boyfriend.getGraphicMidpoint().y - 100);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue