mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-09-12 05:07:06 +00:00
new offset shit in progress
This commit is contained in:
parent
78e205d60f
commit
2a2fd39d1c
|
@ -14,8 +14,12 @@ import flixel.util.FlxColor;
|
||||||
import flixel.util.FlxSpriteUtil;
|
import flixel.util.FlxSpriteUtil;
|
||||||
import lime.utils.Assets as LimeAssets;
|
import lime.utils.Assets as LimeAssets;
|
||||||
import openfl.Assets;
|
import openfl.Assets;
|
||||||
|
import openfl.events.Event;
|
||||||
|
import openfl.events.IOErrorEvent;
|
||||||
|
import openfl.net.FileReference;
|
||||||
import sys.io.File;
|
import sys.io.File;
|
||||||
|
|
||||||
|
using StringTools;
|
||||||
using flixel.util.FlxSpriteUtil;
|
using flixel.util.FlxSpriteUtil;
|
||||||
|
|
||||||
class DebugBoundingState extends FlxState
|
class DebugBoundingState extends FlxState
|
||||||
|
@ -242,6 +246,19 @@ class DebugBoundingState extends FlxState
|
||||||
swagChar.playAnim(animName);
|
swagChar.playAnim(animName);
|
||||||
trace(animName);
|
trace(animName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FlxG.keys.justPressed.ESCAPE)
|
||||||
|
{
|
||||||
|
var outputString:String = "";
|
||||||
|
|
||||||
|
for (i in swagChar.animOffsets.keys())
|
||||||
|
{
|
||||||
|
outputString += i + " " + swagChar.animOffsets.get(i)[0] + " " + swagChar.animOffsets.get(i)[1] + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
outputString.trim();
|
||||||
|
saveOffsets(outputString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var swagChar:Character;
|
var swagChar:Character;
|
||||||
|
@ -277,6 +294,52 @@ class DebugBoundingState extends FlxState
|
||||||
};
|
};
|
||||||
dropDownSetup = true;
|
dropDownSetup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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, swagChar.curCharacter + "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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ANIMDEBUGVIEW
|
enum ANIMDEBUGVIEW
|
||||||
|
|
Loading…
Reference in a new issue