some stuff
This commit is contained in:
@@ -249,6 +249,20 @@ class CharacterEditor extends UIState {
|
||||
|
||||
playAnimation(animOrder[0]);
|
||||
|
||||
var characterMidpoint:FlxPoint = character.getMidpoint();
|
||||
characterMidpoint.x += ((characterPropertiresWindow.bWidth+23)/2);
|
||||
characterMidpoint.x -= (FlxG.width/2)-character.globalOffset.x;
|
||||
characterMidpoint.y -= (FlxG.height/2)-character.globalOffset.y+(23/4);
|
||||
charCamera.scroll = _nextScroll.set(characterMidpoint.x, characterMidpoint.y);
|
||||
characterMidpoint.put();
|
||||
|
||||
_cameraZoomMulti = 1/(1+(0-character.getScreenPosition().y/FlxG.height));
|
||||
if (!(_cameraZoomMulti < 1)) _cameraZoomMulti *= .9;
|
||||
FlxG.camera.zoom = __camZoom = _cameraZoomMulti;
|
||||
|
||||
_nextScroll.x -= ((FlxG.width/2)*FlxG.camera.zoom)-FlxG.width/2;
|
||||
_nextScroll.y += (((FlxG.height/2)*FlxG.camera.zoom)-FlxG.height/2)/2;
|
||||
|
||||
add(topMenuSpr);
|
||||
add(uiGroup);
|
||||
|
||||
@@ -270,18 +284,13 @@ class CharacterEditor extends UIState {
|
||||
}
|
||||
}
|
||||
|
||||
//private var movingCam:Bool = false;
|
||||
//private var camDragSpeed:Float = 1.2;
|
||||
|
||||
private var nextScroll:FlxPoint = FlxPoint.get(0,0);
|
||||
|
||||
var _nextScroll:FlxPoint = FlxPoint.get(0,0);
|
||||
var _cameraZoomMulti:Float = 1;
|
||||
public override function update(elapsed:Float) {
|
||||
super.update(elapsed);
|
||||
|
||||
if (true) {
|
||||
if(FlxG.keys.justPressed.ANY)
|
||||
UIUtil.processShortcuts(topMenu);
|
||||
}
|
||||
if(FlxG.keys.justPressed.ANY)
|
||||
UIUtil.processShortcuts(topMenu);
|
||||
|
||||
if (character != null)
|
||||
characterPropertiresWindow.characterInfo.text = '${character.getNameList().length} Animations\nFlipped: ${character.flipX}\nSprite: ${character.sprite}\nAnim: ${character.getAnimName()}\nOffset: (${character.frameOffset.x}, ${character.frameOffset.y})';
|
||||
@@ -297,7 +306,7 @@ class CharacterEditor extends UIState {
|
||||
openContextMenu(topMenu[2].childs);
|
||||
}
|
||||
if (FlxG.mouse.pressed) {
|
||||
nextScroll.set(nextScroll.x - FlxG.mouse.deltaScreenX, nextScroll.y - FlxG.mouse.deltaScreenY);
|
||||
_nextScroll.set(_nextScroll.x - FlxG.mouse.deltaScreenX, _nextScroll.y - FlxG.mouse.deltaScreenY);
|
||||
currentCursor = HAND;
|
||||
} else
|
||||
currentCursor = ARROW;
|
||||
@@ -305,11 +314,11 @@ class CharacterEditor extends UIState {
|
||||
currentCursor = ARROW;
|
||||
|
||||
charCamera.scroll.set(
|
||||
lerp(charCamera.scroll.x, nextScroll.x, 0.35),
|
||||
lerp(charCamera.scroll.y, nextScroll.y, 0.35)
|
||||
lerp(charCamera.scroll.x, _nextScroll.x, 0.35),
|
||||
lerp(charCamera.scroll.y, _nextScroll.y, 0.35)
|
||||
);
|
||||
|
||||
charCamera.zoom = lerp(charCamera.zoom, __camZoom, 0.125);
|
||||
charCamera.zoom = lerp(charCamera.zoom, __camZoom*_cameraZoomMulti, 0.125);
|
||||
|
||||
characterBG.scale.set(FlxG.width/characterBG.width, FlxG.height/characterBG.height);
|
||||
characterBG.scale.set(characterBG.scale.x / charCamera.zoom, characterBG.scale.y / charCamera.zoom);
|
||||
|
||||
@@ -41,8 +41,8 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
public var iconColor:Null<FlxColor> = null;
|
||||
public var gameOverCharacter:String = Character.FALLBACK_DEAD_CHARACTER;
|
||||
|
||||
public var cameraOffset:FlxPoint = FlxPoint.get();
|
||||
public var globalOffset:FlxPoint = FlxPoint.get();
|
||||
public var cameraOffset:FlxPoint = FlxPoint.get(0, 0);
|
||||
public var globalOffset:FlxPoint = FlxPoint.get(0, 0);
|
||||
|
||||
public var script:Script;
|
||||
public var xml:Access;
|
||||
@@ -169,26 +169,30 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
return super.getScreenBounds(newRect, camera);
|
||||
}
|
||||
|
||||
public override function isOnScreen(?camera:FlxCamera):Bool {
|
||||
if (debugMode) return true;
|
||||
return super.isOnScreen(camera);
|
||||
}
|
||||
|
||||
public function isFlippedOffsets()
|
||||
return (isPlayer != playerOffsets) != (flipX != __baseFlipped);
|
||||
|
||||
public override function draw() {
|
||||
if (isFlippedOffsets()) {
|
||||
__reverseDrawProcedure = true;
|
||||
|
||||
flipX = !flipX;
|
||||
scale.x *= -1;
|
||||
|
||||
super.draw();
|
||||
|
||||
flipX = !flipX;
|
||||
scale.x *= -1;
|
||||
|
||||
__reverseDrawProcedure = false;
|
||||
} else super.draw();
|
||||
}
|
||||
|
||||
public var singAnims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"];
|
||||
public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0)
|
||||
{
|
||||
public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) {
|
||||
var event = EventManager.get(DirectionAnimEvent).recycle(singAnims[direction % singAnims.length] + suffix, direction, suffix, Context, Reversed, Frame, Force);
|
||||
script.call("onPlaySingAnim", [event]);
|
||||
if (!event.cancelled)
|
||||
@@ -244,6 +248,14 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
}
|
||||
|
||||
public function applyXML(xml:Access) { // just for now till i remake the dumb editor
|
||||
gameOverCharacter = Character.FALLBACK_DEAD_CHARACTER;
|
||||
cameraOffset.set(0, 0);
|
||||
globalOffset.set(0, 0);
|
||||
playerOffsets = false;
|
||||
flipX = false;
|
||||
holdTime = 4;
|
||||
iconColor = null;
|
||||
|
||||
animation.destroyAnimations();
|
||||
animDatas.clear();
|
||||
|
||||
@@ -319,7 +331,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
if (scale.x != 1) xml.set("scale", Std.string(FlxMath.roundDecimal(scale.x, 4)));
|
||||
if (!antialiasing) xml.set("antialiasing", antialiasing == true ? "true" : "false");
|
||||
|
||||
xml.set("isPlayer", playerOffsets == true ? "true" : "false");
|
||||
if (playerOffsets) xml.set("isPlayer", playerOffsets == true ? "true" : "false");
|
||||
|
||||
var anims:Array<AnimData> = [];
|
||||
if (animsOrder != null) {
|
||||
|
||||
Reference in New Issue
Block a user