EnemyFlee¶
A coroutine mode for enemy actions to have an enemy party member flee the battle. This will set their fled
to true and enemyfled
to true alongside an animation to move them offscreen.
The coroutine should be stored in tryenemyheal
as it will be set to null when completed so the caller can yield on it.
private IEnumerator EnemyFlee(int walkstate, bool afterimage, int enemyid)
Parameters¶
walkstate
: The animstate to use when the enemy party memberafterimage
: Whether or not to enable the enemy party member'strail
during the moveenemyid
: Theenemydata
index of the enemy party member that will flee
Procedure¶
Scuttle2
sound plays on loop usingsounds[9]
- animstate set to the sent walkstate
flip
set to true- Jump called
- Yield for 0.4 seconds
sounds[9]
pitch set to 1.25- Yield all frames until the enemy party member's
onground
is true - The enemy party member's
trail
set to afterimage Flee
sound playssounds[9]
stop with 0.001 delay- Over the course of 50.0 frames, the enemy party member's position changes to offscreen at (15.0, 0.0, 0.0) via a lerp. Before each frame yield, the animstate is set to the sent walkstate
- The enemy party member's
fled
set to true tryenemyheal
set to null informing the caller that the coroutine completedenemyfled
set to truesounds[9]
stop with 1.0 delay