Skip to content

Commit

Permalink
added "-loop" stuff (#278)
Browse files Browse the repository at this point in the history
* added "-loop" stuff

* added loop anims to the chars

* added to mom and dad for their funny eye glow

* explanation

* Update da.xml

* slightly optimized and a lil better

* oops

this would have actually caused issues since the it would have take the reversed value from the animation before -loop

---------

Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
  • Loading branch information
rodney528 and NexIsDumb authored Aug 27, 2024
1 parent 1b55bef commit 24a65a4
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 30 deletions.
24 changes: 15 additions & 9 deletions assets/data/characters/bf-car.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<!DOCTYPE codename-engine-character>
<character isPlayer="true" flipX="true" x="0" y="350" icon="bf" camx="25" color="#31B0D1">
<anim name="idle" anim="BF idle dance" fps="24" loop="false" x="-5" y="0"/>
<anim name="singUP" anim="BF NOTE UP0" fps="24" loop="false" x="-29" y="27"/>
<anim name="singLEFT" anim="BF NOTE LEFT0" fps="24" loop="false" x="12" y="-6"/>
<anim name="singRIGHT" anim="BF NOTE RIGHT0" fps="24" loop="false" x="-38" y="-7"/>
<anim name="singDOWN" anim="BF NOTE DOWN0" fps="24" loop="false" x="-10" y="-50"/>
<anim name="singUPmiss" anim="BF NOTE UP MISS" fps="24" loop="false" x="-29" y="27"/>
<anim name="singLEFTmiss" anim="BF NOTE LEFT MISS" fps="24" loop="false" x="12" y="24"/>
<anim name="singRIGHTmiss" anim="BF NOTE RIGHT MISS" fps="24" loop="false" x="-30" y="21"/>
<anim name="singDOWNmiss" anim="BF NOTE DOWN MISS" fps="24" loop="false" x="-11" y="-19"/>
<anim name="idle" anim="BF idle dance" fps="24" loop="false" x="-5" y="0"/>
<anim name="singUP" anim="BF NOTE UP0" fps="24" loop="false" x="-29" y="27"/>
<anim name="singLEFT" anim="BF NOTE LEFT0" fps="24" loop="false" x="12" y="-6"/>
<anim name="singRIGHT" anim="BF NOTE RIGHT0" fps="24" loop="false" x="-38" y="-7"/>
<anim name="singDOWN" anim="BF NOTE DOWN0" fps="24" loop="false" x="-10" y="-50"/>
<anim name="singUPmiss" anim="BF NOTE UP MISS" fps="24" loop="false" x="-29" y="27"/>
<anim name="singLEFTmiss" anim="BF NOTE LEFT MISS" fps="24" loop="false" x="12" y="24"/>
<anim name="singRIGHTmiss" anim="BF NOTE RIGHT MISS" fps="24" loop="false" x="-30" y="21"/>
<anim name="singDOWNmiss" anim="BF NOTE DOWN MISS" fps="24" loop="false" x="-11" y="-19"/>
<!-- funny loop -->
<anim name="idle-loop" anim="BF idle dance" fps="24" loop="true" x="-5" y="0" indices="10,11,12,13"/>
<anim name="singUP-loop" anim="BF NOTE UP0" fps="24" loop="true" x="-29" y="27" indices="11,12,13,14"/>
<anim name="singLEFT-loop" anim="BF NOTE LEFT0" fps="24" loop="true" x="12" y="-6" indices="12,13,14,15"/>
<anim name="singRIGHT-loop" anim="BF NOTE RIGHT0" fps="24" loop="true" x="-38" y="-7" indices="58,59,60,61"/>
<anim name="singDOWN-loop" anim="BF NOTE DOWN0" fps="24" loop="true" x="-10" y="-50" indices="26,27,28,29"/>
</character>
15 changes: 10 additions & 5 deletions assets/data/characters/da.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<!DOCTYPE codename-engine-character>
<character isPlayer="false" flipX="false" holdTime="6.1" icon="dad" y="150" color="#AF66CE">
<anim name="idle" anim="Dad idle dance" fps="24" loop="false" x="0" y="0"/>
<anim name="singUP" anim="Dad Sing note UP" fps="24" loop="false" x="-2" y="50"/>
<anim name="singLEFT" anim="dad sing note right" fps="24" loop="false" x="-2" y="10"/>
<anim name="singRIGHT" anim="Dad Sing Note LEFT" fps="24" loop="false" x="-5" y="27"/>
<anim name="singDOWN" anim="Dad Sing Note DOWN" fps="24" loop="false" x="0" y="-30"/>
<anim name="idle" anim="Dad idle dance" fps="24" loop="false" x="0" y="0"/>
<anim name="singUP" anim="Dad Sing note UP" fps="24" loop="false" x="-2" y="50"/>
<anim name="singLEFT" anim="dad sing note right" fps="24" loop="false" x="-2" y="10"/>
<anim name="singRIGHT" anim="Dad Sing Note LEFT" fps="24" loop="false" x="-5" y="27"/>
<anim name="singDOWN" anim="Dad Sing Note DOWN" fps="24" loop="false" x="0" y="-30"/>
<!-- funny loop -->
<anim name="idle-loop" anim="Dad idle dance" fps="24" loop="true" x="0" y="0" indices="10,11,12,12"/>
<anim name="singUP-loop" anim="Dad Sing note UP" fps="24" loop="true" x="-6" y="50" indices="56,57,58,59"/>
<anim name="singLEFT-loop" anim="dad sing note right" fps="24" loop="true" x="-10" y="10" indices="12,13,14,15"/>
<anim name="singRIGHT-loop" anim="Dad Sing Note LEFT" fps="24" loop="true" x="0" y="27" indices="15,16,17,18"/>
</character>
15 changes: 10 additions & 5 deletions assets/data/characters/dad.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<!DOCTYPE codename-engine-character>
<character isPlayer="false" flipX="false" holdTime="6.1" color="#AF66CE">
<anim name="idle" anim="Dad idle dance" fps="24" loop="false" x="0" y="0"/>
<anim name="singUP" anim="Dad Sing note UP" fps="24" loop="false" x="-6" y="50"/>
<anim name="singLEFT" anim="dad sing note right" fps="24" loop="false" x="-10" y="10"/>
<anim name="singRIGHT" anim="Dad Sing Note LEFT" fps="24" loop="false" x="0" y="27"/>
<anim name="singDOWN" anim="Dad Sing Note DOWN" fps="24" loop="false" x="0" y="-30"/>
<anim name="idle" anim="Dad idle dance" fps="24" loop="false" x="0" y="0"/>
<anim name="singUP" anim="Dad Sing note UP" fps="24" loop="false" x="-6" y="50"/>
<anim name="singLEFT" anim="dad sing note right" fps="24" loop="false" x="-10" y="10"/>
<anim name="singRIGHT" anim="Dad Sing Note LEFT" fps="24" loop="false" x="0" y="27"/>
<anim name="singDOWN" anim="Dad Sing Note DOWN" fps="24" loop="false" x="0" y="-30"/>
<!-- funny loop -->
<anim name="idle-loop" anim="Dad idle dance" fps="24" loop="true" x="0" y="0" indices="10,11,12,12"/>
<anim name="singUP-loop" anim="Dad Sing note UP" fps="24" loop="true" x="-6" y="50" indices="56,57,58,59"/>
<anim name="singLEFT-loop" anim="dad sing note right" fps="24" loop="true" x="-10" y="10" indices="12,13,14,15"/>
<anim name="singRIGHT-loop" anim="Dad Sing Note LEFT" fps="24" loop="true" x="0" y="27" indices="15,16,17,18"/>
</character>
14 changes: 10 additions & 4 deletions assets/data/characters/mom-car.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<!DOCTYPE codename-engine-character>
<character isPlayer="false" flipX="false" icon="mom" color="#D8558E">
<anim name="idle" anim="Mom Idle" fps="24" loop="false" />
<anim name="singUP" anim="Mom Up Pose" fps="24" loop="false" x="14" y="71"/>
<anim name="singDOWN" anim="MOM DOWN POSE" fps="24" loop="false" x="20" y="-160"/>
<anim name="singLEFT" anim="Mom Left Pose" fps="24" loop="false" x="250" y="-23"/>
<anim name="idle" anim="Mom Idle" fps="24" loop="false" />
<anim name="singUP" anim="Mom Up Pose" fps="24" loop="false" x="14" y="71"/>
<anim name="singDOWN" anim="MOM DOWN POSE" fps="24" loop="false" x="20" y="-160"/>
<anim name="singLEFT" anim="Mom Left Pose" fps="24" loop="false" x="250" y="-23"/>
<!-- ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT -->
<!-- CUZ DAVE IS DUMB! -->
<anim name="singRIGHT" anim="Mom Pose Left" fps="24" loop="false" x="10" y="-60"/>
<!-- funny loop -->
<anim name="idle-loop" anim="Mom Idle" fps="24" loop="true" indices="10,11,12,13"/>
<anim name="singUP-loop" anim="Mom Up Pose" fps="24" loop="true" x="14" y="71" indices="11,12,13,14"/>
<anim name="singDOWN-loop" anim="MOM DOWN POSE" fps="24" loop="true" x="20" y="-160" indices="11,12,13,14"/>
<anim name="singLEFT-loop" anim="Mom Left Pose" fps="24" loop="true" x="250" y="-23" indices="6,7,8,9"/>
<anim name="singRIGHT-loop" anim="Mom Pose Left" fps="24" loop="true" x="10" y="-60" indices="6,7,8,9"/>
</character>
16 changes: 11 additions & 5 deletions assets/data/characters/mom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<!DOCTYPE codename-engine-character>
<character isPlayer="false" flipX="false" color="#D8558E">
<anim name="idle" anim="Mom Idle" fps="24" loop="false" />
<anim name="singUP" anim="Mom Up Pose" fps="24" loop="false" x="14" y="71"/>
<anim name="singDOWN" anim="MOM DOWN POSE" fps="24" loop="false" x="20" y="-160"/>
<anim name="singLEFT" anim="Mom Left Pose" fps="24" loop="false" x="250" y="-23"/>
<anim name="idle" anim="Mom Idle" fps="24" loop="false" />
<anim name="singUP" anim="Mom Up Pose" fps="24" loop="false" x="14" y="71"/>
<anim name="singDOWN" anim="MOM DOWN POSE" fps="24" loop="false" x="20" y="-160"/>
<anim name="singLEFT" anim="Mom Left Pose" fps="24" loop="false" x="250" y="-23"/>
<!-- ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT -->
<!-- CUZ DAVE IS DUMB! -->
<anim name="singRIGHT" anim="Mom Pose Left" fps="24" loop="false" x="10" y="-60"/>
<anim name="singRIGHT" anim="Mom Pose Left" fps="24" loop="false" x="10" y="-60"/>
<!-- funny loop -->
<anim name="idle-loop" anim="Mom Idle" fps="24" loop="true" indices="10,11,12,13"/>
<anim name="singUP-loop" anim="Mom Up Pose" fps="24" loop="true" x="14" y="71" indices="11,12,13,14"/>
<anim name="singDOWN-loop" anim="MOM DOWN POSE" fps="24" loop="true" x="20" y="-160" indices="9,10,11,12"/>
<anim name="singLEFT-loop" anim="Mom Left Pose" fps="24" loop="true" x="250" y="-23" indices="6,7,8,9"/>
<anim name="singRIGHT-loop" anim="Mom Pose Left" fps="24" loop="true" x="10" y="-60" indices="6,7,8,9"/>
</character>
5 changes: 3 additions & 2 deletions assets/images/characters/mom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
<SubTexture name="MOM DOWN POSE0010" x="1246" y="0" width="403" height="600" frameX="0" frameY="-13" frameWidth="414" frameHeight="613"/>
<SubTexture name="MOM DOWN POSE0011" x="1246" y="0" width="403" height="600" frameX="0" frameY="-13" frameWidth="414" frameHeight="613"/>
<SubTexture name="MOM DOWN POSE0012" x="833" y="0" width="403" height="600" frameX="0" frameY="-13" frameWidth="414" frameHeight="613"/>
<SubTexture name="MOM DOWN POSE0013" x="1659" y="0" width="403" height="600" frameX="0" frameY="-13" frameWidth="414" frameHeight="613"/>
<SubTexture name="MOM DOWN POSE0014" x="1659" y="0" width="403" height="600" frameX="0" frameY="-13" frameWidth="414" frameHeight="613"/>
<!-- commented out because she has no face -->
<!-- <SubTexture name="MOM DOWN POSE0013" x="1659" y="0" width="403" height="600" frameX="0" frameY="-13" frameWidth="414" frameHeight="613"/>
<SubTexture name="MOM DOWN POSE0014" x="1659" y="0" width="403" height="600" frameX="0" frameY="-13" frameWidth="414" frameHeight="613"/> -->
<SubTexture name="Mom Idle0000" x="2072" y="0" width="386" height="826" frameX="-4" frameY="-2" frameWidth="390" frameHeight="829"/>
<SubTexture name="Mom Idle0001" x="2072" y="0" width="386" height="826" frameX="-4" frameY="-2" frameWidth="390" frameHeight="829"/>
<SubTexture name="Mom Idle0002" x="2468" y="0" width="386" height="815" frameX="-4" frameY="-14" frameWidth="390" frameHeight="829"/>
Expand Down
12 changes: 12 additions & 0 deletions source/funkin/backend/FunkinSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
public override function update(elapsed:Float)
{
super.update(elapsed);

// hate how it looks like but hey at least its optimized and fast - Nex
if (isAnimFinished()) {
var name = getAnimName() + '-loop';
if (animation.exists(name))
playAnim(name, false, lastAnimContext);
}

if (animateAtlas != null)
animateAtlas.update(elapsed);
}
Expand Down Expand Up @@ -337,6 +345,10 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
return name;
}

public inline function isAnimReversed():Bool {
return animateAtlas != null ? animateAtlas.anim.reversed : animation.curAnim != null ? animation.curAnim.reversed : false;
}

public inline function removeAnimation(name:String) {
if (animateAtlas != null)
@:privateAccess animateAtlas.anim.animsMap.remove(name);
Expand Down

0 comments on commit 24a65a4

Please sign in to comment.