Prev: C149 Up: Map Next: C1CA
C14D: Handle BLOB and MINE movement
Used by the routine at BFEF.
C14D CALL $C0E0 Handle collision detection for BLOB
Handle for BLOB and MINE movement. This entry point is used by the routine at BFEF.
C150 LD A,(IX+$00) Set new x-position based on x-delta
C153 ADD A,(IX+$04)
C156 LD (IX+$00),A
C159 LD A,(IX+$01) Set new y-position based on y-delta
C15C ADD A,(IX+$05)
C15F LD (IX+$01),A
C162 LD A,(IX+$09) Check enemy type
C165 CP $0F Jump forward if BLOB
C167 JP Z,$C179
C16A LD HL,($A01B) Set HL to the address into tile buffer for MINE
C16D LD DE,$0020
C170 AND A
C171 SBC HL,DE
C173 CALL $D06C is a wall tile type?
C176 JP Z,$981F Jump to destroy MINE if so
C179 DEC (IX+$11) Decrement state change counter
C17C RET NZ Return if no zero
C17D LD A,R Set A a random number between 2-5
C17F AND $03
C181 ADD A,$02
C183 LD (IX+$11),A Reset state change counter
C186 LD A,(IX+$09) Check enemy type
C189 CP $0F Jump forward if BLOB
C18B JP Z,$C198
C18E LD A,(IX+$12) Change state for MINE
C191 XOR $01
C193 LD (IX+$12),A
C196 OR A Return if MINE continue fixed movement
C197 RET Z
C198 LD A,R Set A a random number between 8 and 15
C19A AND $07
C19C ADD A,$08
C19E LD (IX+$11),A Reset state change counter with this number
C1A1 LD A,(IX+$09) Jump to define x/y-delta for BLOB
C1A4 CP $0F
C1A6 JP Z,$C12E
Set x/y-delta for MINE
C1A9 LD (IX+$04),$01 Set x-delta to 1 for MINE
C1AD LD A,($A0B6) if x-position of Rex is less than x-position of MINE then set x-delta to -1
C1B0 CP (IX+$00)
C1B3 JP NC,$C1BA
C1B6 LD (IX+$04),$FF
C1BA LD (IX+$05),$01 Set y-delta to 1 for MINE
C1BE LD A,($A0B7) if y-position of Rex is less than y-position of MINE then set y-delta to -1
C1C1 CP (IX+$01)
C1C4 RET NC
C1C5 LD (IX+$05),$FF
C1C9 RET
Prev: C149 Up: Map Next: C1CA