Prev: CC81 Up: Map Next: CCE9
CCCE: Primary Enemy Entity Handler
Entity handler stored in primary wave enemy records. Called once per frame by the entity dispatcher in DispatchWordFromHL. Searches the entity list for a collision-free position via Find_Colliding_Entity. If a free position exists, hands off to Process_Enemy_Entity to draw the entity and detect contact with other enemies. Otherwise checks whether the enemy touches the player via HitTestBounds8AtHL; if the player is hit, the death transition fires via Strip_Attributes_And_Fade.
Primary_Enemy_Entity_Handler CCCE EXX Switch to alternate registers and search the entity list for a free slot via Find_Colliding_Entity; restore main registers.
CCCF CALL Find_Colliding_Entity
CCD2 EXX
CCD3 JR NC,Process_Enemy_Entity If a free slot was found, hand off to Process_Enemy_Entity.
CCD5 EXX Load the player's screen position into alternate HL.
CCD6 LD HL,$C4D4
CCD9 EXX
CCDA CALL HitTestBounds8AtHL Test whether the enemy's bounds overlap the player via HitTestBounds8AtHL.
CCDD JP NC,Strip_Attributes_And_Fade If the player is hit, trigger the death transition via Strip_Attributes_And_Fade.
CCE0 INC HL Advance the entity list pointer four bytes and save it in BC.
CCE1 INC HL
CCE2 INC HL
CCE3 INC HL
CCE4 LD B,H
CCE5 LD C,L
CCE6 JP Draw_Spawned_Entity_Attribute Write the entity's attribute colour via Draw_Spawned_Entity_Attribute.
Prev: CC81 Up: Map Next: CCE9