mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-14 19:25:16 -05:00
Fixes to animation looping and holds
This commit is contained in:
parent
0294ea0b79
commit
f7a3d43e54
10 changed files with 91 additions and 34 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -71,6 +71,7 @@
|
|||
|
||||
"haxe.displayPort": "auto",
|
||||
"haxe.enableCompilationServer": false,
|
||||
"haxe.enableServerView": true,
|
||||
"haxe.displayServer": {
|
||||
"arguments": ["-v"]
|
||||
},
|
||||
|
|
2
assets
2
assets
|
@ -1 +1 @@
|
|||
Subproject commit 874f7de39ee2dfe2ffe4c02edf701d36f2a393fd
|
||||
Subproject commit dcfda23b549f84a2314d3b676972af237f321ac7
|
|
@ -116,7 +116,9 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
}
|
||||
|
||||
anim.callback = function(_, frame:Int) {
|
||||
if (frame == (anim.getFrameLabel(id).duration - 1) + anim.getFrameLabel(id).index)
|
||||
var offset = loop ? 0 : -1;
|
||||
|
||||
if (frame == (anim.getFrameLabel(id).duration + offset) + anim.getFrameLabel(id).index)
|
||||
{
|
||||
if (loop)
|
||||
{
|
||||
|
@ -183,7 +185,7 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
public function cleanupAnimation(_:String):Void
|
||||
{
|
||||
canPlayOtherAnims = true;
|
||||
this.currentAnimation = null;
|
||||
// this.currentAnimation = null;
|
||||
this.anim.pause();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,8 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
var _skipTransformChildren:Bool = false;
|
||||
|
||||
var animations:Map<String, AnimateAtlasAnimation> = new Map<String, AnimateAtlasAnimation>();
|
||||
var currentAnimation:String;
|
||||
var currentAnimName:Null<String> = null;
|
||||
var animFinished:Bool = false;
|
||||
|
||||
public function new(id:String)
|
||||
{
|
||||
|
@ -88,15 +89,21 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
if ((!canPlayOtherAnims && !ignoreOther)) return;
|
||||
|
||||
var correctName = correctAnimationName(name);
|
||||
if (correctName == null) return;
|
||||
if (correctName == null)
|
||||
{
|
||||
trace('Could not find Atlas animation: ' + name);
|
||||
return;
|
||||
}
|
||||
|
||||
var animData = getAnimationData(correctName);
|
||||
currentAnimation = correctName;
|
||||
currentAnimName = correctName;
|
||||
var prefix:String = animData.prefix;
|
||||
if (prefix == null) prefix = correctName;
|
||||
var loop:Bool = animData.looped;
|
||||
|
||||
this.mainSprite.playAnimation(prefix, restart, ignoreOther, loop);
|
||||
|
||||
animFinished = false;
|
||||
}
|
||||
|
||||
public override function hasAnimation(name:String):Bool
|
||||
|
@ -104,6 +111,15 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
return getAnimationData(name) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the animation has finished playing.
|
||||
* Never true if animation is configured to loop.
|
||||
*/
|
||||
public override function isAnimationFinished():Bool
|
||||
{
|
||||
return animFinished;
|
||||
}
|
||||
|
||||
function loadAtlasSprite():FlxAtlasSprite
|
||||
{
|
||||
trace('[ATLASCHAR] Loading sprite atlas for ${characterId}.');
|
||||
|
@ -128,6 +144,8 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
{
|
||||
// Make the game hold on the last frame.
|
||||
this.mainSprite.cleanupAnimation(prefix);
|
||||
// currentAnimName = null;
|
||||
animFinished = true;
|
||||
|
||||
// Fallback to idle!
|
||||
// playAnimation('idle', true, false);
|
||||
|
@ -178,7 +196,8 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
|
||||
public override function getCurrentAnimation():String
|
||||
{
|
||||
return this.mainSprite.getCurrentAnimation();
|
||||
// return this.mainSprite.getCurrentAnimation();
|
||||
return currentAnimName;
|
||||
}
|
||||
|
||||
function getAnimationData(name:String = null):AnimateAtlasAnimation
|
||||
|
|
|
@ -16,26 +16,53 @@ class NoteSprite extends FunkinSprite
|
|||
var hsvShader:HSVShader;
|
||||
|
||||
/**
|
||||
* The time at which the note should be hit, in milliseconds.
|
||||
* The strum time at which the note should be hit, in milliseconds.
|
||||
*/
|
||||
public var strumTime(default, set):Float;
|
||||
public var strumTime(get, set):Float;
|
||||
|
||||
function get_strumTime():Float
|
||||
{
|
||||
return this.noteData?.time ?? 0.0;
|
||||
}
|
||||
|
||||
function set_strumTime(value:Float):Float
|
||||
{
|
||||
this.strumTime = value;
|
||||
return this.strumTime;
|
||||
if (this.noteData == null) return value;
|
||||
return this.noteData.time = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The length for which the note should be held, in milliseconds.
|
||||
* Defaults to 0 for single notes.
|
||||
*/
|
||||
public var length(get, set):Float;
|
||||
|
||||
function get_length():Float
|
||||
{
|
||||
return this.noteData?.length ?? 0.0;
|
||||
}
|
||||
|
||||
function set_length(value:Float):Float
|
||||
{
|
||||
if (this.noteData == null) return value;
|
||||
return this.noteData.length = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* An extra attribute for the note.
|
||||
* For example, whether the note is an "alt" note, or whether it has custom behavior on hit.
|
||||
*/
|
||||
public var kind(default, set):String;
|
||||
public var kind(get, set):Null<String>;
|
||||
|
||||
function get_kind():Null<String>
|
||||
{
|
||||
return this.noteData?.kind;
|
||||
}
|
||||
|
||||
function set_kind(value:String):String
|
||||
{
|
||||
this.kind = value;
|
||||
return this.kind;
|
||||
if (this.noteData == null) return value;
|
||||
return this.noteData.kind = value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,16 +127,13 @@ class NoteSprite extends FunkinSprite
|
|||
*/
|
||||
public var handledMiss:Bool;
|
||||
|
||||
public function new(noteStyle:NoteStyle, strumTime:Float = 0, direction:Int = 0)
|
||||
public function new(noteStyle:NoteStyle, direction:Int = 0)
|
||||
{
|
||||
super(0, -9999);
|
||||
this.strumTime = strumTime;
|
||||
this.direction = direction;
|
||||
|
||||
this.hsvShader = new HSVShader();
|
||||
|
||||
if (this.strumTime < 0) this.strumTime = 0;
|
||||
|
||||
setupNoteGraphic(noteStyle);
|
||||
|
||||
// Disables the update() function for performance.
|
||||
|
|
|
@ -659,7 +659,6 @@ class Strumline extends FlxSpriteGroup
|
|||
|
||||
if (noteSprite != null)
|
||||
{
|
||||
noteSprite.strumTime = note.time;
|
||||
noteSprite.direction = note.getDirection();
|
||||
noteSprite.noteData = note;
|
||||
|
||||
|
|
|
@ -5308,7 +5308,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
var startTimestamp:Float = 0;
|
||||
if (playtestStartTime) startTimestamp = scrollPositionInMs + playheadPositionInMs;
|
||||
|
||||
var playbackRate:Float = (menubarItemPlaybackSpeed.value.toFloat() * 2.0) / 100.0;
|
||||
var playbackRate:Float = ((menubarItemPlaybackSpeed.value ?? 1.0) * 2.0) / 100.0;
|
||||
playbackRate = Math.floor(playbackRate / 0.05) * 0.05; // Round to nearest 5%
|
||||
playbackRate = Math.max(0.05, Math.min(2.0, playbackRate)); // Clamp to 5% to 200%
|
||||
|
||||
|
|
|
@ -117,18 +117,30 @@ class ChartEditorDropdowns
|
|||
"ugh" => "Ugh (Week 7)",
|
||||
"hehPrettyGood" => "Heh, Pretty Good (Week 7)",
|
||||
// Weekend 1
|
||||
"weekend-1-lightcan" => "Light Can (2hot)",
|
||||
"weekend-1-kickcan" => "Kick Can (2hot)",
|
||||
"weekend-1-kneecan" => "Knee Can (2hot)",
|
||||
"weekend-1-cockgun" => "Cock Gun (2hot)",
|
||||
"weekend-1-firegun" => "Fire Gun (2hot)",
|
||||
"weekend-1-punchlow" => "Punch Low (Blazin)",
|
||||
"weekend-1-punchhigh" => "Punch High (Blazin)",
|
||||
"weekend-1-punchlowblocked" => "Punch Low Blocked (Blazin)",
|
||||
"weekend-1-punchhighblocked" => "Punch High Blocked (Blazin)",
|
||||
"weekend-1-dodgelow" => "Dodge Low (Blazin)",
|
||||
"weekend-1-blockhigh" => "Block High (Blazin)",
|
||||
"weekend-1-fakeout" => "Fakeout (Blazin)",
|
||||
"weekend-1-punchhigh" => "Punch High (Blazin')",
|
||||
"weekend-1-punchhighdodged" => "Punch High (Dodge) (Blazin')",
|
||||
"weekend-1-punchhighblocked" => "Punch High (Block) (Blazin')",
|
||||
"weekend-1-punchhighspin" => "Punch High (Spin) (Blazin')",
|
||||
"weekend-1-punchlow" => "Punch Low (Blazin')",
|
||||
"weekend-1-punchlowdodged" => "Punch Low (Dodge) (Blazin')",
|
||||
"weekend-1-punchlowblocked" => "Punch Low (Block) (Blazin')",
|
||||
"weekend-1-punchlowspin" => "Punch High (Spin) (Blazin')",
|
||||
"weekend-1-picouppercutprep" => "Pico Uppercut (Prep) (Blazin')",
|
||||
"weekend-1-picouppercut" => "Pico Uppercut (Blazin')",
|
||||
"weekend-1-blockhigh" => "Block High (Blazin')",
|
||||
"weekend-1-blocklow" => "Dodge High (Blazin')",
|
||||
"weekend-1-blockspin" => "Block High (Spin) (Blazin')",
|
||||
"weekend-1-dodgehigh" => "Block Low (Blazin')",
|
||||
"weekend-1-dodgelow" => "Dodge Low (Blazin')",
|
||||
"weekend-1-dodgespin" => "Dodge High (Spin) (Blazin')",
|
||||
"weekend-1-hithigh" => "Hit High (Blazin')",
|
||||
"weekend-1-hitlow" => "Hit Low (Blazin')",
|
||||
"weekend-1-hitspin" => "Hit High (Spin) (Blazin')",
|
||||
"weekend-1-darnelluppercutprep" => "Darnell Uppercut (Prep) (Blazin')",
|
||||
"weekend-1-darnelluppercut" => "Darnell Uppercut (Blazin')",
|
||||
"weekend-1-idle" => "Idle (Blazin')",
|
||||
"weekend-1-fakeout" => "Fakeout (Blazin')",
|
||||
"weekend-1-reversefakeout" => "Reverse Fakeout (Blazin')",
|
||||
];
|
||||
|
||||
public static function populateDropdownWithNoteKinds(dropDown:DropDown, startingKindId:String):DropDownEntry
|
||||
|
|
|
@ -130,7 +130,7 @@ class LatencyState extends MusicBeatSubState
|
|||
|
||||
for (i in 0...32)
|
||||
{
|
||||
var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault(), Conductor.instance.beatLengthMs * i);
|
||||
var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault());
|
||||
noteGrp.add(note);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class ColorsMenu extends Page
|
|||
|
||||
for (i in 0...4)
|
||||
{
|
||||
var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault(), 0, i);
|
||||
var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault(), i);
|
||||
|
||||
note.x = (100 * i) + i;
|
||||
note.screenCenter(Y);
|
||||
|
|
Loading…
Reference in a new issue