Prev: D1A5 Up: Map Next: D251
D1F5: The update routine for a spider that runs straight, and a creature from the sky
Graphics 16 and 17, a spider (both show the same sprite), enter here and flip their picture every turn as they go; graphics 80 and 81, a creature that falls from the sky (SKY_DROP), enter at SKY_ROAMER, which skips the flip. Either is deadly both ways (MAKE_DEADLY), and falls, faster each turn since its steps are never cleared, but never lower than 129: below that it is put back at 129 with no fall.
It runs straight at four units a turn until it bumps into something, which the collision code shows by clearing the step. Then it picks a new way, the sign from bit 3 of R: along U if the bump was in V, otherwise along V. The way it faces goes with the way it runs: bit 0 of the graphic and the mirror bit (6) of the flags make four facings from two pictures.
Input
IX the object record
ROAMER D1F5 LD A,(IX+$07) flip the picture
D1F8 XOR $40
D1FA LD (IX+$07),A
SKY_ROAMER D1FD CALL DRAW_AT_L16_D8 SKY_ROAMER: the drawing nudge
D200 CALL MAKE_DEADLY deadly; fall
D203 CALL DEC_DZ_AND_UPDATE_UVZ
D206 LD A,(IX+$03) no lower than 129
D209 CP $81
D20B JR NC,ROAMER_0
D20D LD (IX+$03),$81
D211 LD (IX+$0B),$00
ROAMER_0 D215 LD A,(IX+$09) still moving: redraw
D218 OR (IX+$0A)
D21B JP NZ,SET_WIPE_AND_DRAW_FLAGS
D21E LD A,R stopped: four units, either way
D220 AND $08
D222 SUB $04
D224 BIT 1,(IX+$0C) not bumped in V: along V, graphic odd, not mirrored...
D228 JR NZ,ROAMER_1
D22A LD (IX+$0A),A
D22D SET 0,(IX+$00)
D231 RES 6,(IX+$07)
D235 JR ROAMER_2
ROAMER_1 D237 LD (IX+$09),A ...bumped in V: along U, graphic even, mirrored
D23A RES 0,(IX+$00)
D23E SET 6,(IX+$07)
ROAMER_2 D242 AND A going backwards: the other graphic of the two; redraw
D243 JP P,SET_WIPE_AND_DRAW_FLAGS
D246 LD A,(IX+$00)
D249 XOR $01
D24B LD (IX+$00),A
D24E JP SET_WIPE_AND_DRAW_FLAGS
Prev: D1A5 Up: Map Next: D251