Skip to content

Commit

Permalink
both fixed and broke stuff maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealJake12 committed Oct 4, 2024
1 parent 545121d commit 628c01b
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions source/kec/states/editors/CharacterEditorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ class CharacterEditorState extends UIState
ghost.frames.frames = char.frames.frames;
ghost.animation.copyFrom(char.animation);
setGhostFrame();
ghost.setPosition(char.x, char.y);
}

private function setAntiAliasing()
Expand Down Expand Up @@ -530,12 +531,14 @@ class CharacterEditorState extends UIState

function updateAnimText()
{
/*
charToLoad.text = char.data.char;
charAssets.text = char.data.assets[0];
charIcon.text = char.data.icon;
charRed.pos = char.data.rgb[0];
charGreen.pos = char.data.rgb[1];
charBlue.pos = char.data.rgb[2];
*/
animName.text = curAnim.name;
animFPS.pos = curAnim.frameRate == null ? 24 : curAnim.frameRate;
animPrefix.text = curAnim.prefix;
Expand Down Expand Up @@ -623,30 +626,38 @@ class CharacterEditorState extends UIState

function updateAnim()
{
if (!char.animation.exists(animName.text))
if (!animList.toString().contains(animName.text))
return;
final indices:Array<String> = animIndices.text.split(',');
var newIndices:Array<Int> = [];
if (indices.length > 1)
try
{
for (i in indices)
newIndices.push(Std.parseInt(i));
final indices:Array<String> = animIndices.text.split(',');
var newIndices:Array<Int> = [];
if (indices.length > 1)
{
for (i in indices)
newIndices.push(Std.parseInt(i));
}
curAnim = char.data.animations[curAnimSelected];
curAnim.name = animName.text;
curAnim.frameRate = animFPS.pos == 0 ? 24 : Std.int(animFPS.pos);
curAnim.prefix = animPrefix.text;
curAnim.frameIndices = newIndices;
curAnim.looped = animLooped.selected;
char.playAnim(char.data.animations[0].name, true);
char.animation.remove(curAnim.name);
addAnimation(curAnim.name, curAnim.prefix, curAnim.frameRate, curAnim.looped, newIndices);
reloadTexts();
switchAnim();
}
catch(e)
{
Debug.logError(e);
}
curAnim = char.data.animations[curAnimSelected];
curAnim.name = animName.text;
curAnim.frameRate = animFPS.pos == 0 ? 24 : Std.int(animFPS.pos);
curAnim.prefix = animPrefix.text;
curAnim.frameIndices = newIndices;
curAnim.looped = animLooped.selected;
char.animation.remove(animName.text);
addAnimation(curAnim.name, curAnim.prefix, curAnim.frameRate, curAnim.looped, newIndices);
reloadTexts();
switchAnim();
}

function removeAnim()
{
if ((!animList.toString().contains(animName.text) || !char.animation.exists(animName.text)) || animList.length - 1 < 1)
if (!animList.toString().contains(animName.text) || animList.length - 1 < 1)
return;
// wack bullshit
final name = animList[curAnimSelected].name;
Expand Down

0 comments on commit 628c01b

Please sign in to comment.