Skip to content

Commit 9648cb6

Browse files
do this neato fix
1 parent 5490233 commit 9648cb6

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

source/Character.hx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,9 @@ class Character extends FlxSprite
164164
public function loadCharacterFile(json:CharacterFile)
165165
{
166166
isAnimateAtlas = false;
167-
167+
168168
#if flxanimate
169-
var animToFind:String = Paths.getPath('images/' + json.image + '/Animation.json', TEXT);
170-
if (#if MODS_ALLOWED FileSystem.exists(animToFind) || #end Assets.exists(animToFind))
169+
if (Paths.fileExists('images/' + json.image + '/Animation.json', TEXT))
171170
isAnimateAtlas = true;
172171
#end
173172

source/editors/CharacterEditorState.hx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -671,16 +671,10 @@ class CharacterEditorState extends MusicBeatState
671671
imageInputText.focusGained = () -> FlxG.stage.window.textInputEnabled = true;
672672
var reloadImage:FlxButton = new FlxButton(imageInputText.x + 210, imageInputText.y - 3, "Reload Image", function()
673673
{
674-
if (sys.FileSystem.exists(Paths.modsImages(imageInputText.text)) || sys.FileSystem.exists('assets/shared/images/' + imageInputText.text))
675-
{
676-
char.imageFile = imageInputText.text;
677-
reloadCharacterImage();
678-
if(char.animation.curAnim != null) {
679-
char.playAnim(char.animation.curAnim.name, true);
680-
}
681-
} else {
682-
trace ("mods/" + Paths.currentModDirectory + '/images/' + imageInputText.text + ".png or assets/shared/images/" + imageInputText.text + ".png couldn't be found!");
683-
CoolUtil.coolError("The image/XML you tried to load couldn't be found!\nEither it doesn't exist, or the name doesn't match with the one you're putting?", "JS Engine Anti-Crash Tool");
674+
char.imageFile = imageInputText.text;
675+
reloadCharacterImage();
676+
if(char.animation.curAnim != null) {
677+
char.playAnim(char.animation.curAnim.name, true);
684678
}
685679
});
686680

@@ -1153,7 +1147,7 @@ class CharacterEditorState extends MusicBeatState
11531147
}
11541148
char.isAnimateAtlas = true;
11551149
}
1156-
else
1150+
else if (Paths.fileExists('images/' + char.imageFile + '.png', IMAGE))
11571151
{
11581152
var split:Array<String> = char.imageFile.split(',');
11591153
var charFrames:FlxAtlasFrames = Paths.getAtlas(split[0].trim());
@@ -1171,6 +1165,9 @@ class CharacterEditorState extends MusicBeatState
11711165
}
11721166
}
11731167
char.frames = charFrames;
1168+
} else {
1169+
trace ("The png file the game looked for wasn't found!");
1170+
CoolUtil.coolError("The image/XML/Atlas files you tried to load couldn't be found!\nEither it doesn't exist, or the name doesn't match with the one you're putting?", "JS Engine Anti-Crash Tool");
11741171
}
11751172

11761173
for (anim in anims) {

0 commit comments

Comments
 (0)