mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-26 15:07:14 +00:00
spookeez scared animation lightning fix
This commit is contained in:
parent
caa7ae6ddd
commit
e844b93641
|
@ -1,8 +1,8 @@
|
||||||
package funkin.play.character;
|
package funkin.play.character;
|
||||||
|
|
||||||
|
import flixel.graphics.frames.FlxFramesCollection;
|
||||||
import funkin.modding.events.ScriptEvent;
|
import funkin.modding.events.ScriptEvent;
|
||||||
import funkin.util.assets.FlxAnimationUtil;
|
import funkin.util.assets.FlxAnimationUtil;
|
||||||
import flixel.graphics.frames.FlxFramesCollection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For some characters which use Sparrow atlases, the spritesheets need to be split
|
* For some characters which use Sparrow atlases, the spritesheets need to be split
|
||||||
|
@ -174,10 +174,10 @@ class MultiSparrowCharacter extends BaseCharacter
|
||||||
trace('[MULTISPARROWCHAR] Successfully loaded ${animNames.length} animations for ${characterId}');
|
trace('[MULTISPARROWCHAR] Successfully loaded ${animNames.length} animations for ${characterId}');
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function playAnimation(name:String, restart:Bool = false):Void
|
public override function playAnimation(name:String, restart:Bool = false, ?ignoreOther:Bool = false):Void
|
||||||
{
|
{
|
||||||
loadFramesByAnimName(name);
|
loadFramesByAnimName(name);
|
||||||
super.playAnimation(name, restart);
|
super.playAnimation(name, restart, ignoreOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
override function set_frames(value:FlxFramesCollection):FlxFramesCollection
|
override function set_frames(value:FlxFramesCollection):FlxFramesCollection
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package funkin.play.stage;
|
package funkin.play.stage;
|
||||||
|
|
||||||
|
import flixel.FlxG;
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
import funkin.modding.IScriptedClass.IPlayStateScriptedClass;
|
import funkin.modding.IScriptedClass.IPlayStateScriptedClass;
|
||||||
import funkin.modding.events.ScriptEvent;
|
import funkin.modding.events.ScriptEvent;
|
||||||
|
@ -42,6 +43,8 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
|
||||||
*/
|
*/
|
||||||
public var shouldBop:Bool = true;
|
public var shouldBop:Bool = true;
|
||||||
|
|
||||||
|
public var finishCallbackMap:Map<String, Void->Void> = new Map<String, Void->Void>();
|
||||||
|
|
||||||
function set_idleSuffix(value:String):String
|
function set_idleSuffix(value:String):String
|
||||||
{
|
{
|
||||||
this.idleSuffix = value;
|
this.idleSuffix = value;
|
||||||
|
@ -82,6 +85,11 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.danceEvery = danceEvery;
|
this.danceEvery = danceEvery;
|
||||||
|
this.animation.finishCallback = function(name)
|
||||||
|
{
|
||||||
|
if (finishCallbackMap[name] != null)
|
||||||
|
finishCallbackMap[name]();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_shouldAlternate():Void
|
function update_shouldAlternate():Void
|
||||||
|
@ -106,7 +114,7 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
|
||||||
/**
|
/**
|
||||||
* Called every `danceEvery` beats of the song.
|
* Called every `danceEvery` beats of the song.
|
||||||
*/
|
*/
|
||||||
public function dance(force:Bool = false):Void
|
public function dance(forceRestart:Bool = false):Void
|
||||||
{
|
{
|
||||||
if (this.animation == null)
|
if (this.animation == null)
|
||||||
{
|
{
|
||||||
|
@ -122,17 +130,17 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
|
||||||
{
|
{
|
||||||
if (hasDanced)
|
if (hasDanced)
|
||||||
{
|
{
|
||||||
playAnimation('danceRight$idleSuffix', force);
|
playAnimation('danceRight$idleSuffix', forceRestart);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playAnimation('danceLeft$idleSuffix', force);
|
playAnimation('danceLeft$idleSuffix', forceRestart);
|
||||||
}
|
}
|
||||||
hasDanced = !hasDanced;
|
hasDanced = !hasDanced;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playAnimation('idle$idleSuffix', force);
|
playAnimation('idle$idleSuffix', forceRestart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,18 +187,39 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var canPlayOtherAnims:Bool = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name The name of the animation to play.
|
* @param name The name of the animation to play.
|
||||||
* @param restart Whether to restart the animation if it is already playing.
|
* @param restart Whether to restart the animation if it is already playing.
|
||||||
|
* @param ignoreOther Whether to ignore all other animation inputs, until this one is done playing
|
||||||
*/
|
*/
|
||||||
public function playAnimation(name:String, restart:Bool = false):Void
|
public function playAnimation(name:String, restart:Bool = false, ?ignoreOther:Bool = false):Void
|
||||||
{
|
{
|
||||||
|
if (ignoreOther == null)
|
||||||
|
ignoreOther = false;
|
||||||
|
|
||||||
|
if (!canPlayOtherAnims)
|
||||||
|
return;
|
||||||
|
|
||||||
var correctName = correctAnimationName(name);
|
var correctName = correctAnimationName(name);
|
||||||
if (correctName == null)
|
if (correctName == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.animation.play(correctName, restart, false, 0);
|
this.animation.play(correctName, restart, false, 0);
|
||||||
|
|
||||||
|
if (ignoreOther)
|
||||||
|
{
|
||||||
|
canPlayOtherAnims = false;
|
||||||
|
|
||||||
|
// doing it with this funny map, since overriding the animation.finishCallback is a bit messier IMO
|
||||||
|
finishCallbackMap[name] = function()
|
||||||
|
{
|
||||||
|
canPlayOtherAnims = true;
|
||||||
|
finishCallbackMap[name] = null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
applyAnimationOffsets(correctName);
|
applyAnimationOffsets(correctName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue