Skip to content

Commit

Permalink
Merge pull request #656 from FunkinCrew/feature/nene-combo-anims
Browse files Browse the repository at this point in the history
Implement combo animations for Nene + other changes
  • Loading branch information
ninjamuffin99 authored Jul 11, 2024
2 parents cffe419 + 966fce3 commit 7cd19a0
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 22 deletions.
2 changes: 1 addition & 1 deletion assets
1 change: 0 additions & 1 deletion source/funkin/play/character/BaseCharacter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ class BaseCharacter extends Bopper
if (!currentAnimation.startsWith('dance') && !currentAnimation.startsWith('idle') && !isAnimationFinished()) return;
}

trace('${characterId}: Actually dancing');
// Otherwise, fallback to the super dance() method, which handles playing the idle animation.
super.dance();
}
Expand Down
2 changes: 0 additions & 2 deletions source/funkin/play/stage/Bopper.hx
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,8 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
*/
public function onStepHit(event:SongTimeScriptEvent)
{
if (danceEvery > 0) trace('step hit(${danceEvery}): ${event.step % (danceEvery * Constants.STEPS_PER_BEAT)} == 0?');
if (danceEvery > 0 && (event.step % (danceEvery * Constants.STEPS_PER_BEAT)) == 0)
{
trace('dance onStepHit!');
dance(shouldBop);
}
}
Expand Down
147 changes: 129 additions & 18 deletions source/funkin/play/stage/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,16 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
* A function that gets called once per step in the song.
* @param curStep The current step number.
*/
public function onStepHit(event:SongTimeScriptEvent):Void {}
public function onStepHit(event:SongTimeScriptEvent):Void
{
// Override me in your scripted stage to perform custom behavior!
// Make sure to call super.onStepHit(event) if you want to keep the boppers dancing.

for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

/**
* A function that gets called once per beat in the song (once every four steps).
Expand All @@ -786,7 +795,13 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
}
}

public function onUpdate(event:UpdateScriptEvent) {}
public function onUpdate(event:UpdateScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public override function kill()
{
Expand Down Expand Up @@ -866,35 +881,131 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
return StageRegistry.instance.parseEntryDataWithMigration(id, StageRegistry.instance.fetchEntryVersion(id));
}

public function onScriptEvent(event:ScriptEvent) {}
public function onScriptEvent(event:ScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onPause(event:PauseScriptEvent) {}
public function onPause(event:PauseScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onResume(event:ScriptEvent) {}
public function onResume(event:ScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onSongStart(event:ScriptEvent) {}
public function onSongStart(event:ScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onSongEnd(event:ScriptEvent) {}
public function onSongEnd(event:ScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onGameOver(event:ScriptEvent) {}
public function onGameOver(event:ScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onCountdownStart(event:CountdownScriptEvent) {}
public function onCountdownStart(event:CountdownScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onCountdownStep(event:CountdownScriptEvent) {}
public function onCountdownStep(event:CountdownScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onCountdownEnd(event:CountdownScriptEvent) {}
public function onCountdownEnd(event:CountdownScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onNoteIncoming(event:NoteScriptEvent) {}
public function onNoteIncoming(event:NoteScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onNoteHit(event:HitNoteScriptEvent) {}
public function onNoteHit(event:HitNoteScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onNoteMiss(event:NoteScriptEvent) {}
public function onNoteMiss(event:NoteScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onSongEvent(event:SongEventScriptEvent) {}
public function onSongEvent(event:SongEventScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onNoteGhostMiss(event:GhostMissNoteScriptEvent) {}
public function onNoteGhostMiss(event:GhostMissNoteScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onSongLoaded(event:SongLoadScriptEvent) {}
public function onSongLoaded(event:SongLoadScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}

public function onSongRetry(event:ScriptEvent) {}
public function onSongRetry(event:ScriptEvent)
{
for (bopper in boppers)
{
ScriptEventDispatcher.callEvent(bopper, event);
}
}
}

0 comments on commit 7cd19a0

Please sign in to comment.