|  | Routines | 
| Prev: 39760 | Up: Map | Next: 39933 | 
| 
Used by the routine at 39137.
 | ||||
| 39776 | LD IY,44868 | Load IY with address of complex state data for large yellow creature (level 3) | ||
| 39780 | LD IX,(34240) | Load IX with address of current level's complex state data for Berk | ||
| 39784 | LD HL,44877 | Load HL with address of large yellow creature's flags... | ||
| 39787 | LD A,(HL) | ...and load flags into A | ||
| 39788 | CP 2 | If creature is in "rising from floor" mode... | ||
| 39790 | JR Z,39831 | ...then skip ahead to 39831 | ||
| 39792 | CP 4 | If creature is in "hunting" mode... | ||
| 39794 | JR Z,39845 | ...then skip ahead to 39845 | ||
| 39796 | CP 8 | If creature is in "attacking" mode... | ||
| 39798 | JR Z,39918 | ...then skip ahead to 39918 | ||
| 39800 | CP 16 | If creature is in "just attacked" mode... | ||
| 39802 | JP Z,39934 | ...then set creature's mode to "returning home", set Berk-has-been-killed flag and return | ||
| 39805 | LD A,(IX+0) | If Berk's current room is not 3 (large yellow creature's room)... | ||
| 39808 | CP 3 | ... | ||
| 39810 | JP NZ,39998 | ...then set creature's mode to "returning home", move one step closer to home and return | ||
| 
"Returning home" mode
 | ||||
| 39813 | LD A,(IY+5) | If x-coordinate of creature's left side... | ||
| 39816 | CP (IX+5) | ...is the same as that of Berk's left side... | ||
| 39819 | JR Z,39828 | ...then skip ahead to 39828 | ||
| 39821 | INC A | If x-coordinate of creature's left side... | ||
| 39822 | CP (IX+5) | ...is not one character to the right of Berk's left side... | ||
| 39825 | JP NZ,39998 | ...then set creature's mode to "returning home", move one step closer to home and return | ||
| 39828 | LD A,2 | Set creature's mode to "rising from floor"... | ||
| 39830 | LD (HL),A | ... | ||
| 
"Rising from floor" mode
 | ||||
| 39831 | CALL 39971 | Move creature such that its left edge is up to two characters closer to Berk's | ||
| 39834 | CALL 39961 | Move creature up by two characters | ||
| 39837 | LD A,(IY+4) | If y-coordinate of creature's top... | ||
| 39840 | CP 108 | ...is 108 or greater... | ||
| 39842 | RET NC | ...then return | ||
| 39843 | LD (HL),4 | Set creature's mode to "hunting" | ||
| 
"Hunting" mode
 | ||||
| 39845 | LD A,(IX+0) | If Berk's current room is not 3 (large yellow creature's room)... | ||
| 39848 | CP 3 | ... | ||
| 39850 | JP NZ,39998 | ...then set creature's mode to "returning home", move one step closer to home and return | ||
| 39853 | LD A,(34220) | If Berk's current power is invisibility (level 3)... | ||
| 39856 | CP 11 | ... | ||
| 39858 | JR Z,39909 | ...then skip ahead to 39909 ("confused" mode) | ||
| 39860 | LD A,(IX+4) | If y-coordinate of Berk's top... | ||
| 39863 | CP 103 | ...is less than 103... | ||
| 39865 | JR C,39909 | ...then skip ahead to 39909 ("confused" mode) | ||
| 39867 | CALL 39971 | Move creature such that its left edge is up to two characters closer to Berk's | ||
| 39870 | LD A,(IY+4) | If creature's top... | ||
| 39873 | ADD A,4 | ...is four characters above Berk's top... | ||
| 39875 | CP (IX+4) | ... | ||
| 39878 | JR Z,39890 | ...then skip ahead to 39890 (set "attacking" mode) | ||
| 39880 | JR NC,39961 | If creature's top is less than 4 characters above Berk's top then move creature up by two characters and return | ||
| 39882 | INC A | If creature's top is five characters above Berk's top... | ||
| 39883 | CP (IX+4) | ... | ||
| 39886 | JR Z,39890 | ...then skip ahead to 39890 (set "attacking" mode) | ||
| 39888 | JR C,39951 | If creature's top is more than five characters above Berk's top then move creature down two characters and return | ||
| 39890 | LD (HL),8 | Set creature's mode to "attacking" | ||
| 39892 | LD (IY+1),1 | Set creature's depth to 1 | ||
| 39896 | SET 5,(IX+9) | Set Berk's do-not-update-state flag | ||
| 39900 | LD BC,40442 | Set graphic layout data address for creature to 40442 (large yellow creature with mouth open)... | ||
| 39903 | CALL 39944 | ... | ||
| 39906 | JP 36296 | Make Berk drop the entity he is holding, load IY with its complex state data address and return | ||
| 
"Confused" mode
 | ||||
| 39909 | LD BC,40485 | Set graphic layout data address for creature to 40485 (large yellow creature, animated, confused)... | ||
| 39912 | CALL 39944 | ... | ||
| 39915 | JP 40008 | Move creature one step closer to x (left) = 113, y (top) > 111 if not already there, and return | ||
| 
"Attacking" mode
 | ||||
| 39918 | CALL 39951 | Move creature down two characters | ||
| 39921 | LD (IX+1),0 | Set Berk's depth to zero | ||
| 39925 | LD (HL),16 | Set creature's mode to "just attacked" | ||
| 39927 | LD BC,40451 | Set graphic layout data address for creature to 40451 (large yellow creature with mouth closed)... | ||
| 39930 | JP 39944 | ...and return | ||
| Prev: 39760 | Up: Map | Next: 39933 |