atlas ghostes :O
This commit is contained in:
@@ -114,8 +114,7 @@ class CharacterAnimsWindow extends UIButtonList<CharacterAnimButton> {
|
||||
}
|
||||
|
||||
public function findValid():Null<String> {
|
||||
for (button in buttons)
|
||||
if (button.valid) return button.anim;
|
||||
for (button in buttons) if (button.valid) return button.anim;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -672,7 +672,7 @@ class CharacterEditor extends UIState {
|
||||
|
||||
function _animation_play(_) {
|
||||
if (character.getNameList().length != 0)
|
||||
playAnimation(character.getAnimName());
|
||||
playAnimation(characterFakeAnim);
|
||||
}
|
||||
|
||||
function _animation_stop(_) {
|
||||
@@ -698,12 +698,11 @@ class CharacterEditor extends UIState {
|
||||
|
||||
// The animation thats playing regardless if its valid or not
|
||||
public var characterFakeAnim:String = "";
|
||||
public function playAnimation(anim:String) {
|
||||
public function playAnimation(anim:String) @:privateAccess {
|
||||
characterFakeAnim = anim;
|
||||
if (characterAnimsWindow.animButtons[anim] != null && characterAnimsWindow.animButtons[anim].valid) {
|
||||
character.playAnim(anim, true);
|
||||
character.colorTransform.redMultiplier = character.colorTransform.greenMultiplier = character.colorTransform.blueMultiplier = character.colorTransform.alphaMultiplier = 1;
|
||||
character.colorTransform.redOffset = character.colorTransform.greenOffset = character.colorTransform.blueOffset = character.colorTransform.alphaOffset = 0;
|
||||
character.colorTransform.__identity();
|
||||
} else {
|
||||
var validAnimation:String = characterAnimsWindow.findValid();
|
||||
if (validAnimation != null) character.playAnim(validAnimation, true);
|
||||
|
||||
@@ -6,13 +6,35 @@ import funkin.game.Character;
|
||||
|
||||
class CharacterGhost extends Character {
|
||||
public var ghosts:Array<String> = [];
|
||||
public override function draw() {
|
||||
public override function draw() @:privateAccess {
|
||||
ghostDraw = true;
|
||||
|
||||
if (animateAtlas != null) {}
|
||||
var wasInvalidFrame:Bool = !colorTransform.__isDefault(false);
|
||||
colorTransform.__identity();
|
||||
|
||||
if (animateAtlas != null) {
|
||||
var ogFrame:Int = animateAtlas.anim.curFrame;
|
||||
var oldTick:Float = animateAtlas.anim._tick;
|
||||
var oldPlaying:Bool = animateAtlas.anim.isPlaying;
|
||||
|
||||
for (anim in ghosts) {
|
||||
animateAtlas.anim.play(anim, true, false, 0);
|
||||
setAnimOffset(anim);
|
||||
|
||||
alpha = 0.4; color = 0xFFAEAEAE;
|
||||
super.draw();
|
||||
}
|
||||
|
||||
if (ghosts.length > 0) {
|
||||
trace(atlasPlayingAnim, ogFrame, oldTick, oldPlaying);
|
||||
animateAtlas.anim.play(atlasPlayingAnim, true, false, ogFrame);
|
||||
animateAtlas.anim._tick = oldTick;
|
||||
animateAtlas.anim.isPlaying = oldPlaying;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (anim in ghosts) @:privateAccess {
|
||||
alpha = 0.4; color = 0xFFAEAEAE;
|
||||
alpha = 0.4; color = 0xFFAEAEAE;
|
||||
|
||||
var flxanim:FlxAnimation = animation._animations.get(anim);
|
||||
var frameIndex:Int = flxanim.frames.getDefault([0])[0];
|
||||
@@ -22,12 +44,18 @@ class CharacterGhost extends Character {
|
||||
super.draw();
|
||||
}
|
||||
|
||||
frame = frames.frames[animation.frameIndex];
|
||||
setAnimOffset(animation.name);
|
||||
alpha = 1; color = 0xFFFFFFFF;
|
||||
if (ghosts.length > 0)
|
||||
frame = frames.frames[animation.frameIndex];
|
||||
}
|
||||
ghostDraw = false;
|
||||
|
||||
|
||||
alpha = 1; color = 0xFFFFFFFF;
|
||||
if (wasInvalidFrame) {
|
||||
frameOffset.set(0, 0);
|
||||
offset.set(globalOffset.x * (isPlayer != playerOffsets ? 1 : -1), -globalOffset.y);
|
||||
colorTransform.color = 0xFFEF0202;
|
||||
} else
|
||||
setAnimOffset(animateAtlas != null ? atlasPlayingAnim : animation.name);
|
||||
super.draw();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user