Prev: 892B Up: Map Next: 8986
8936: Enemy movement: Move sprite along path and update sprite type
Used by the routine at update_sprite_path.
Input
IX Sprite data
HL Path address
move_animate_sprite_along_path 8936 LD A,(HL) Get path byte
8937 LD HL,(wave_data_address) Get wave data address
893A BIT 0,(IX+$03) If bit 0 of counter is reset
893E JR Z,move_animate_sprite_along_path_0 Then skip moving to next byte
8940 INC HL Else move to next byte
move_animate_sprite_along_path_0 8941 BIT 7,(HL) Is bit 7 reset
8943 JR Z,move_animate_sprite_along_path_1 Then skip ahead
8945 AND $0F Isolate bits 0-3
8947 CP $01 If 1 (inc polar y)
8949 JR Z,move_animate_sprite_along_path_1 Then skip ahead
894B CP $04 If 4 (dec polar y)
894D JR Z,move_animate_sprite_along_path_1 Then skip ahead
894F XOR $0A Else flip bits 1 and 3
move_animate_sprite_along_path_1 8951 LD E,(IX+$02) Get polar x
8954 LD D,(IX+$01) Get polar y
8957 LD B,(IX+$00) Get sprite type
895A BIT 0,A If bit for incrementing polar y is reset
895C JR Z,move_animate_sprite_along_path_2 Then skip next
895E INC D Increment polar y
895F LD B,$0E Sprite type $0E
move_animate_sprite_along_path_2 8961 BIT 2,A If bit for decrementing polar y is reset
8963 JR Z,move_animate_sprite_along_path_3 Then skip next
8965 DEC D Decrement polar y
8966 LD B,$10 Sprite type $10
move_animate_sprite_along_path_3 8968 BIT 1,A If bit for decrementing polar x is reset
896A JR Z,move_animate_sprite_along_path_4 Then skip next
896C DEC E Decrement polar x
896D LD B,$0F Sprite type $0F
move_animate_sprite_along_path_4 896F BIT 3,A If bit for incrementing polar x is reset
8971 JR Z,move_animate_sprite_along_path_5 Then skip next
8973 INC E Increment polar x
8974 LD B,$11 Sprite type $11
move_animate_sprite_along_path_5 8976 LD (IX+$00),B Set sprite type
8979 LD (IX+$01),D Set polar y
897C LD A,E Polar x
897D AND $3F Mod 64
897F LD (IX+$02),A Set polar x
8982 INC (IX+$05) Mark for pattern reload
8985 RET Return to return_from_sprite_handler
Prev: 892B Up: Map Next: 8986