1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-08-20 15:35:13 +00:00

remvoed animationdebug shit

This commit is contained in:
Cameron Taylor 2021-06-05 00:01:15 -04:00
parent 820ee969d0
commit 8aa50b9d47
2 changed files with 39 additions and 309 deletions

View file

@ -1,259 +0,0 @@
package;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.addons.display.FlxGridOverlay;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import openfl.events.Event;
import openfl.events.IOErrorEvent;
import openfl.net.FileReference;
using StringTools;
/**
*DEBUG MODE
*/
class AnimationDebug extends FlxState
{
var bf:Boyfriend;
var dad:Character;
var char:Character;
var textAnim:FlxText;
var dumbTexts:FlxTypedGroup<FlxText>;
var animList:Array<String> = [];
var curAnim:Int = 0;
var isDad:Bool = true;
var daAnim:String = 'spooky';
var camFollow:FlxObject;
public function new(daAnim:String = 'spooky')
{
super();
this.daAnim = daAnim;
}
override function create()
{
FlxG.sound.music.stop();
var gridBG:FlxSprite = FlxGridOverlay.create(10, 10);
gridBG.scrollFactor.set(0.5, 0.5);
add(gridBG);
if (daAnim == 'bf')
isDad = false;
if (isDad)
{
dad = new Character(0, 0, daAnim);
dad.screenCenter();
dad.debugMode = true;
add(dad);
char = dad;
dad.flipX = false;
}
else
{
bf = new Boyfriend(0, 0);
bf.screenCenter();
bf.debugMode = true;
add(bf);
char = bf;
bf.flipX = false;
}
dumbTexts = new FlxTypedGroup<FlxText>();
add(dumbTexts);
textAnim = new FlxText(300, 16);
textAnim.size = 26;
textAnim.scrollFactor.set();
add(textAnim);
genBoyOffsets();
camFollow = new FlxObject(0, 0, 2, 2);
camFollow.screenCenter();
add(camFollow);
FlxG.camera.follow(camFollow);
super.create();
}
function genBoyOffsets(pushList:Bool = true):Void
{
var daLoop:Int = 0;
for (anim => offsets in char.animOffsets)
{
var text:FlxText = new FlxText(10, 20 + (18 * daLoop), 0, anim + ": " + offsets, 15);
text.scrollFactor.set();
text.color = FlxColor.BLUE;
dumbTexts.add(text);
if (pushList)
animList.push(anim);
daLoop++;
}
}
function updateTexts():Void
{
dumbTexts.forEach(function(text:FlxText)
{
text.kill();
dumbTexts.remove(text, true);
});
}
override function update(elapsed:Float)
{
textAnim.text = char.animation.curAnim.name;
if (FlxG.keys.justPressed.E)
FlxG.camera.zoom += 0.25;
if (FlxG.keys.justPressed.Q)
FlxG.camera.zoom -= 0.25;
if (FlxG.keys.pressed.I || FlxG.keys.pressed.J || FlxG.keys.pressed.K || FlxG.keys.pressed.L)
{
if (FlxG.keys.pressed.I)
camFollow.velocity.y = -90;
else if (FlxG.keys.pressed.K)
camFollow.velocity.y = 90;
else
camFollow.velocity.y = 0;
if (FlxG.keys.pressed.J)
camFollow.velocity.x = -90;
else if (FlxG.keys.pressed.L)
camFollow.velocity.x = 90;
else
camFollow.velocity.x = 0;
}
else
{
camFollow.velocity.set();
}
if (FlxG.keys.justPressed.W)
{
curAnim -= 1;
}
if (FlxG.keys.justPressed.S)
{
curAnim += 1;
}
if (curAnim < 0)
curAnim = animList.length - 1;
if (curAnim >= animList.length)
curAnim = 0;
if (FlxG.keys.justPressed.S || FlxG.keys.justPressed.W || FlxG.keys.justPressed.SPACE)
{
char.playAnim(animList[curAnim]);
updateTexts();
genBoyOffsets(false);
}
var upP = FlxG.keys.anyJustPressed([UP]);
var rightP = FlxG.keys.anyJustPressed([RIGHT]);
var downP = FlxG.keys.anyJustPressed([DOWN]);
var leftP = FlxG.keys.anyJustPressed([LEFT]);
var holdShift = FlxG.keys.pressed.SHIFT;
var multiplier = 1;
if (holdShift)
multiplier = 10;
if (upP || rightP || downP || leftP)
{
updateTexts();
if (upP)
char.animOffsets.get(animList[curAnim])[1] += 1 * multiplier;
if (downP)
char.animOffsets.get(animList[curAnim])[1] -= 1 * multiplier;
if (leftP)
char.animOffsets.get(animList[curAnim])[0] += 1 * multiplier;
if (rightP)
char.animOffsets.get(animList[curAnim])[0] -= 1 * multiplier;
updateTexts();
genBoyOffsets(false);
char.playAnim(animList[curAnim]);
}
if (FlxG.keys.justPressed.ESCAPE)
{
var outputString:String = "";
for (swagAnim in animList)
{
outputString += swagAnim + " " + char.animOffsets.get(swagAnim)[0] + " " + char.animOffsets.get(swagAnim)[1] + "\n";
}
outputString.trim();
saveOffsets(outputString);
}
super.update(elapsed);
}
var _file:FileReference;
private function saveOffsets(saveString:String)
{
if ((saveString != null) && (saveString.length > 0))
{
_file = new FileReference();
_file.addEventListener(Event.COMPLETE, onSaveComplete);
_file.addEventListener(Event.CANCEL, onSaveCancel);
_file.addEventListener(IOErrorEvent.IO_ERROR, onSaveError);
_file.save(saveString, daAnim + "Offsets.txt");
}
}
function onSaveComplete(_):Void
{
_file.removeEventListener(Event.COMPLETE, onSaveComplete);
_file.removeEventListener(Event.CANCEL, onSaveCancel);
_file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError);
_file = null;
FlxG.log.notice("Successfully saved LEVEL DATA.");
}
/**
* Called when the save file dialog is cancelled.
*/
function onSaveCancel(_):Void
{
_file.removeEventListener(Event.COMPLETE, onSaveComplete);
_file.removeEventListener(Event.CANCEL, onSaveCancel);
_file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError);
_file = null;
}
/**
* Called if there is an error while saving the gameplay recording.
*/
function onSaveError(_):Void
{
_file.removeEventListener(Event.COMPLETE, onSaveComplete);
_file.removeEventListener(Event.CANCEL, onSaveCancel);
_file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError);
_file = null;
FlxG.log.error("Problem saving Level data");
}
}

View file

@ -925,7 +925,7 @@ class PlayState extends MusicBeatState
default:
startCountdown();
}
}
}
super.create();
}
@ -1500,24 +1500,26 @@ class PlayState extends MusicBeatState
introSprPaths = ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel'];
}
var introSndPaths:Array<String> = ["intro3" + altSuffix, "intro2" + altSuffix,
"intro1" + altSuffix, "introGo" + altSuffix];
var introSndPaths:Array<String> = [
"intro3" + altSuffix, "intro2" + altSuffix,
"intro1" + altSuffix, "introGo" + altSuffix
];
if (swagCounter > 0)
readySetGo(introSprPaths[swagCounter - 1]);
FlxG.sound.play(Paths.sound(introSndPaths[swagCounter]), 0.6);
/* switch (swagCounter)
{
case 0:
case 1:
case 2:
case 3:
} */
{
case 0:
case 1:
case 2:
case 3:
}*/
swagCounter += 1;
}, 4);
@ -1994,19 +1996,7 @@ class PlayState extends MusicBeatState
#if debug
if (FlxG.keys.justPressed.ONE)
endSong();
if (FlxG.keys.justPressed.EIGHT)
{
/* 8 for opponent char
SHIFT+8 for player char
CTRL+SHIFT+8 for gf */
if (FlxG.keys.pressed.SHIFT)
if (FlxG.keys.pressed.CONTROL)
FlxG.switchState(new AnimationDebug(gf.curCharacter));
else
FlxG.switchState(new AnimationDebug(SONG.player1));
else
FlxG.switchState(new AnimationDebug(SONG.player2));
}
if (FlxG.keys.justPressed.PAGEUP)
changeSection(1);
if (FlxG.keys.justPressed.PAGEDOWN)
@ -2214,7 +2204,7 @@ class PlayState extends MusicBeatState
// var noteMiss:Bool = daNote.y < -daNote.height;
// if (PreferencesMenu.getPref('downscroll'))
// noteMiss = daNote.y > FlxG.height;
// noteMiss = daNote.y > FlxG.height;
if (daNote.isSustainNote && daNote.wasGoodHit)
{
@ -2756,11 +2746,11 @@ class PlayState extends MusicBeatState
/* boyfriend.stunned = true;
// get stunned for 5 seconds
new FlxTimer().start(5 / 60, function(tmr:FlxTimer)
{
boyfriend.stunned = false;
}); */
// get stunned for 5 seconds
new FlxTimer().start(5 / 60, function(tmr:FlxTimer)
{
boyfriend.stunned = false;
});*/
switch (direction)
{
@ -2777,25 +2767,24 @@ class PlayState extends MusicBeatState
/* not used anymore lol
function badNoteHit()
{
// just double pasting this shit cuz fuk u
// REDO THIS SYSTEM!
var leftP = controls.NOTE_LEFT_P;
var downP = controls.NOTE_DOWN_P;
var upP = controls.NOTE_UP_P;
var rightP = controls.NOTE_RIGHT_P;
if (leftP)
noteMiss(0);
if (downP)
noteMiss(1);
if (upP)
noteMiss(2);
if (rightP)
noteMiss(3);
} */
function badNoteHit()
{
// just double pasting this shit cuz fuk u
// REDO THIS SYSTEM!
var leftP = controls.NOTE_LEFT_P;
var downP = controls.NOTE_DOWN_P;
var upP = controls.NOTE_UP_P;
var rightP = controls.NOTE_RIGHT_P;
if (leftP)
noteMiss(0);
if (downP)
noteMiss(1);
if (upP)
noteMiss(2);
if (rightP)
noteMiss(3);
}*/
function goodNoteHit(note:Note):Void
{
if (!note.wasGoodHit)