Prev: 6C13 Up: Map Next: 6CC9
6C9D: Check Collision
CheckCollision 6C9D LD A,($6693) Return if Flag_Shield is active.
6CA0 OR A
6CA1 RET NZ
6CA2 LD HL,($66ED) Load the player attribute position from PlayerAttributeBufferPosition.
6CA5 LD B,$02 Set a counter in B for 02 rows to check.
CheckCollision_RowLoop 6CA7 PUSH BC Stash the row counter and attribute position on the stack.
6CA8 PUSH HL
6CA9 LD B,$03 Set a counter in B for 03 columns to check.
CheckCollision_ColumnLoop 6CAB LD A,(HL) Load the attribute at this position.
6CAC OR A Skip this position if the attribute is INK:BLACK, PAPER:BLACK (empty space).
6CAD JR Z,CheckCollision_NextColumn
6CAF CP $46 Skip this position if the attribute is INK:YELLOW, PAPER:BLACK (BRIGHT) (player ship).
6CB1 JR Z,CheckCollision_NextColumn
6CB3 CP $07 Skip this position if the attribute is INK:WHITE, PAPER:BLACK (white/ background).
6CB5 JR Z,CheckCollision_NextColumn
See Immunity.
Collision detected - trigger player death.
6CB7 LD A,$01 Set Flag_Collision to 01.
6CB9 LD ($66A4),A
6CBC POP AF Discard the saved positions from the stack.
6CBD POP AF
6CBE RET Return.
Move to the next attribute.
CheckCollision_NextColumn 6CBF INC HL Move to the next attribute position (right one column).
6CC0 DJNZ CheckCollision_ColumnLoop Loop back to CheckCollision_ColumnLoop until all 03 columns are checked.
6CC2 POP HL Restore the starting attribute position for this row.
6CC3 SET 5,L Move down one row (set bit 5 of L = add 20).
6CC5 POP BC Restore the row counter and loop back to CheckCollision_RowLoop until both rows are checked.
6CC6 DJNZ CheckCollision_RowLoop
6CC8 RET Return.
Prev: 6C13 Up: Map Next: 6CC9