Prev: EE54 Up: Map Next: EE9A
EE66: Handle Gargoyle
Handler for the object types 34 to 37 the gargoyle (see Sprite_Gargoyle_1). It is a flying creature that is handled like the jellyfish (see Handle_Jellyfish), and it shares the routines that animate and move it.
When the gargoyle is in a different room x from Sabreman, its y velocity is set to a random 20 or E0 (see Choose_Random_Velocity) and Move_Creature_Horizontally moves it towards his room. When it is in the same room x but a different room y, its x velocity is set to a random 20 or E0 and Move_Creature_Vertically moves it towards his room. When it is in the same room as Sabreman it is animated and moves in the same way as the jellyfish (see Handle_Jellyfish_Set_X_Velocity).
Input
IX Object record
Handle_Gargoyle EE66 CALL Read_World_Map Read the world map entry of the room that the gargoyle is in. The flags of the room are returned in E.
EE69 LD A,(IX+$0B) Fetch the contact flags of the gargoyle.
EE6C OR E Combine them with the flags of the room.
EE6D LD E,A Store the result in E.
EE6E LD A,($8F1C) Fetch the room x of Sabreman.
EE71 CP (IX+$02) Jump to Handle_Gargoyle_Different_Room_X if the gargoyle is in a different room x.
EE74 JR NZ,Handle_Gargoyle_Different_Room_X
EE76 LD A,($8F1E) Fetch the room y of Sabreman.
EE79 CP (IX+$04) Jump to Handle_Gargoyle_Different_Room_Y if the gargoyle is in a different room y.
EE7C JR NZ,Handle_Gargoyle_Different_Room_Y
EE7E CALL Animate_Jellyfish Animate the gargoyle.
EE81 JP Handle_Jellyfish_Set_X_Velocity Jump to Handle_Jellyfish_Set_X_Velocity to set the x velocity and to move the gargoyle.
Handle_Gargoyle_Different_Room_X EE84 PUSH AF Stash the result of the comparison, as the carry flag says which way Sabreman's room is.
EE85 CALL Choose_Random_Velocity Choose a velocity.
EE88 LD (IX+$09),A Set the y velocity.
EE8B POP AF Restore the result of the comparison.
EE8C JP Move_Creature_Horizontally Jump to Move_Creature_Horizontally to move the gargoyle towards the room x of Sabreman.
Handle_Gargoyle_Different_Room_Y EE8F PUSH AF Stash the result of the comparison, as the carry flag says which way Sabreman's room is.
EE90 CALL Choose_Random_Velocity Choose a velocity.
EE93 LD (IX+$08),A Set the x velocity.
EE96 POP AF Restore the result of the comparison.
EE97 JP Move_Creature_Vertically Jump to Move_Creature_Vertically to move the gargoyle towards the room y of Sabreman.
Prev: EE54 Up: Map Next: EE9A