Skip to content
This repository was archived by the owner on Mar 15, 2025. It is now read-only.

Commit 628c01b

Browse files
committed
both fixed and broke stuff maybe
1 parent 545121d commit 628c01b

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

source/kec/states/editors/CharacterEditorState.hx

+28-17
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ class CharacterEditorState extends UIState
333333
ghost.frames.frames = char.frames.frames;
334334
ghost.animation.copyFrom(char.animation);
335335
setGhostFrame();
336+
ghost.setPosition(char.x, char.y);
336337
}
337338

338339
private function setAntiAliasing()
@@ -530,12 +531,14 @@ class CharacterEditorState extends UIState
530531

531532
function updateAnimText()
532533
{
534+
/*
533535
charToLoad.text = char.data.char;
534536
charAssets.text = char.data.assets[0];
535537
charIcon.text = char.data.icon;
536538
charRed.pos = char.data.rgb[0];
537539
charGreen.pos = char.data.rgb[1];
538540
charBlue.pos = char.data.rgb[2];
541+
*/
539542
animName.text = curAnim.name;
540543
animFPS.pos = curAnim.frameRate == null ? 24 : curAnim.frameRate;
541544
animPrefix.text = curAnim.prefix;
@@ -623,30 +626,38 @@ class CharacterEditorState extends UIState
623626

624627
function updateAnim()
625628
{
626-
if (!char.animation.exists(animName.text))
629+
if (!animList.toString().contains(animName.text))
627630
return;
628-
final indices:Array<String> = animIndices.text.split(',');
629-
var newIndices:Array<Int> = [];
630-
if (indices.length > 1)
631+
try
631632
{
632-
for (i in indices)
633-
newIndices.push(Std.parseInt(i));
633+
final indices:Array<String> = animIndices.text.split(',');
634+
var newIndices:Array<Int> = [];
635+
if (indices.length > 1)
636+
{
637+
for (i in indices)
638+
newIndices.push(Std.parseInt(i));
639+
}
640+
curAnim = char.data.animations[curAnimSelected];
641+
curAnim.name = animName.text;
642+
curAnim.frameRate = animFPS.pos == 0 ? 24 : Std.int(animFPS.pos);
643+
curAnim.prefix = animPrefix.text;
644+
curAnim.frameIndices = newIndices;
645+
curAnim.looped = animLooped.selected;
646+
char.playAnim(char.data.animations[0].name, true);
647+
char.animation.remove(curAnim.name);
648+
addAnimation(curAnim.name, curAnim.prefix, curAnim.frameRate, curAnim.looped, newIndices);
649+
reloadTexts();
650+
switchAnim();
651+
}
652+
catch(e)
653+
{
654+
Debug.logError(e);
634655
}
635-
curAnim = char.data.animations[curAnimSelected];
636-
curAnim.name = animName.text;
637-
curAnim.frameRate = animFPS.pos == 0 ? 24 : Std.int(animFPS.pos);
638-
curAnim.prefix = animPrefix.text;
639-
curAnim.frameIndices = newIndices;
640-
curAnim.looped = animLooped.selected;
641-
char.animation.remove(animName.text);
642-
addAnimation(curAnim.name, curAnim.prefix, curAnim.frameRate, curAnim.looped, newIndices);
643-
reloadTexts();
644-
switchAnim();
645656
}
646657

647658
function removeAnim()
648659
{
649-
if ((!animList.toString().contains(animName.text) || !char.animation.exists(animName.text)) || animList.length - 1 < 1)
660+
if (!animList.toString().contains(animName.text) || animList.length - 1 < 1)
650661
return;
651662
// wack bullshit
652663
final name = animList[curAnimSelected].name;

0 commit comments

Comments
 (0)