Prev: 42266 Up: Map Next: 42486
42381: Update state of snake (level 4)
Used by the routine at 41211.
42381 LD IX,45495 Point IX at start of state data for snake (level 4)
42385 LD IY,(34240) Load IY with address of current level's complex state data for Berk
42389 LD HL,45507 Load HL with address of snake's attack progress index
42392 LD A,(HL) If snake's attack progress index is not zero...
42393 OR A ...
42394 JR NZ,42415 ...then skip ahead to 42415
Snake's attack progress index is zero
42396 LD A,(IY+0) If Berk's room is not 5 (snake's room)...
42399 CP 5 ...
42401 RET NZ ...then return
42402 BIT 7,(IY+12) If Berk's is-jumping flag is set...
42406 JR NZ,42413 ...then skip ahead to 42413
42408 BIT 0,(IY+9) If snake's must-process-current-script-data flag is set...
42412 RET NZ ...then return
42413 INC (HL) Increase snake's attack progress index
42414 RET Return
Snake's attack progress index is not zero
42415 CP 8 If snake's attack progress index is less than 8...
42417 JR C,42454 ...then jump to 42454 (snake moving right)
42419 CP 15 If snake's attack progress index is less than 15...
42421 JR C,42459 ...then jump to 42459 (snake preparing to pounce)
42423 CP 17 If snake's attack progress index is less than 17...
42425 JR C,42461 ...then jump to 42461 (snake pouncing)
42427 JR Z,42480 If snake's attack progress index is 17 then jump to 42480 (snake finished pouncing)
Snake's attack progress index is greater than 17
42429 LD (HL),20 Set snake's attack progress index to 20
42431 LD BC,42648 Set snake's graphic layout data address to 42648...
42434 CALL 42512 ...(snake, mouth closed, with animated tongue)
42437 LD A,(IX+5) If x-coordinate of snake's left edge is not 83...
42440 CP 83 ...
42442 JR NZ,42447 ...then move snake left one character and return
42444 LD (HL),0 Set snake's attack progress index to 0
42446 RET Return
This entry point is used by the routine at 41961.
42447 DEC (IX+5) Decrease x-coordinates of left and right edges of entity at IX by one...
42450 DEC (IX+7) ...
42453 RET Return
Snake's attack progress index is less than 8
42454 INC (HL) Increase snake's attack progress index
42455 CALL 42505 Move snake right one character
42458 RET Return
Snake's attack progress index is 8 or more, but less than 15
42459 INC (HL) Increase snake's attack progress index
42460 RET Return
Snake's attack progress index is 15 or more, but less than 17
42461 LD A,(IY+6) If the y-coordinate of Berk's bottom edge is less than 116...
42464 CP 116 ...
42466 JR C,42429 ...then jump back to 42429
42468 CALL 42486 Open snake's mouth and set Berk-has-been-killed flag if snake and Berk have collided
42471 LD B,4 Move snake right four characters...
42473 CALL 42505 ...
42476 DJNZ 42473 ...
42478 INC (HL) Increase snake's attack progress index
42479 RET Return
Snake's attack progress index is 17
42480 CALL 42486 Open snake's mouth and set Berk-has-been-killed flag if snake and Berk have collided
42483 LD (HL),20 Set snake's attack progress index to 20
42485 RET Return
Prev: 42266 Up: Map Next: 42486