Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
added a few wip stuff for characters
added anti-crash for the character editor
  • Loading branch information
JordanSantiagoYT committed Nov 28, 2023
1 parent 72cb797 commit 39969a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion source/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ class Character extends FlxSprite
public var positionArray:Array<Float> = [0, 0];
public var cameraPosition:Array<Float> = [0, 0];

public var otherCharacters:Array<Character>;

public var hasMissAnimations:Bool = false;

public var isDeathCharacter:Bool = false;

//Used on Character Editor
public var imageFile:String = '';
public var jsonScale:Float = 1;
Expand All @@ -82,7 +86,7 @@ class Character extends FlxSprite
public var healthColorArray:Array<Int> = [255, 0, 0];

public static var DEFAULT_CHARACTER:String = 'bf'; //In case a character is missing, it will use BF on its place
public function new(x:Float, y:Float, ?character:String = 'bf', ?isPlayer:Bool = false)
public function new(x:Float, y:Float, ?character:String = 'bf', ?isPlayer:Bool = false, ?isDeathCharacter:Bool = false)
{
super(x, y);

Expand Down
13 changes: 9 additions & 4 deletions source/editors/CharacterEditorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,15 @@ class CharacterEditorState extends MusicBeatState
imageInputText.focusGained = () -> FlxG.stage.window.textInputEnabled = true;
var reloadImage:FlxButton = new FlxButton(imageInputText.x + 210, imageInputText.y - 3, "Reload Image", function()
{
char.imageFile = imageInputText.text;
reloadCharacterImage();
if(char.animation.curAnim != null) {
char.playAnim(char.animation.curAnim.name, true);
if (Paths.fileExists('images/' + char.imageFile, IMAGE))
{
char.imageFile = imageInputText.text;
reloadCharacterImage();
if(char.animation.curAnim != null) {
char.playAnim(char.animation.curAnim.name, true);
}
} else {
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");
}
});

Expand Down

0 comments on commit 39969a1

Please sign in to comment.