Prev: BF77 Up: Map Next: BFBF
BF8F: Script Routine: (24) Task-two entity action
Step the task-two entity one character vertically along its walk.
Input
IX Address of complex state data for an entity
ScriptRoutine_TaskTwoWalkVertical BF8F LD A,(IX+$05) Load A with the current entity's y-coordinate.
BF92 DEC A Step the current entity's y-coordinate back by one.
BF93 CP $15 Is the current entity's y-coordinate equal to 15? If so, jump to ScriptRoutine_TaskTwoWalkVertical_AtY15.
BF95 JR Z,ScriptRoutine_TaskTwoWalkVertical_AtY15
BF97 CP $1B Is the current entity's y-coordinate equal to 1B? If not, jump to ScriptRoutine_TaskTwoWalkVertical_DecY.
BF99 JR NZ,ScriptRoutine_TaskTwoWalkVertical_DecY
BF9B LD A,($72B3) Load A with the game event flags (GameEventFlags).
BF9E RES 4,A Clear bit 04 of the flag byte in A.
BFA0 LD ($72B3),A Set the game event flags (GameEventFlags).
Keep walking the task-two entity one row up, then continue the script.
ScriptRoutine_TaskTwoWalkVertical_DecY BFA3 DEC (IX+$05) Move this entity one character up.
BFA6 DEC (IX+$06)
BFA9 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
At y 15: run bound script BirdScript_BoundLoop if the spawn latch is set, else idle.
ScriptRoutine_TaskTwoWalkVertical_AtY15 BFAC LD A,($72B5) Load A with the task-two flags (TaskTwoFlags).
BFAF BIT 2,A Is bit 02 of task-two flags set? If not, jump to ScriptRoutine_TaskTwoWalkVertical_RunIdleScript.
BFB1 JR Z,ScriptRoutine_TaskTwoWalkVertical_RunIdleScript
BFB3 LD HL,$BEB9 Point HL at bird script data BirdScript_BoundLoop.
BFB6 JP ScriptInstruction Jump to ScriptInstruction to execute the script instruction at HL.
Vertical walk finished: run the task-two idle script (BirdScript_IdleLoop).
ScriptRoutine_TaskTwoWalkVertical_RunIdleScript BFB9 LD HL,$BE81 Point HL at bird script data BirdScript_IdleLoop.
BFBC JP ScriptInstruction Jump to ScriptInstruction to execute the script instruction at HL.
Prev: BF77 Up: Map Next: BFBF