Prev: 6B20 Up: Map Next: 6B70
6B3A: Eat Flower
Used by the routines at UpdateLeech, UpdateMidges, MidgesWeaponHit and UpdateSlug.
Updates a bug which is eating the flower. Every update adds one to the count of the bugs that are eating in BugsEating_Flower (which the flower uses to decide whether to sink, see UpdateFlower), and the bug wobbles up and down. When the flower has sunk below the bug, it stops eating.
Input
IX Bug object
EatFlower 6B3A INC (IX+$05) Increment the eating counter in IX+05 by one.
6B3D LD A,($5E3B) Increment BugsEating_Flower by one.
6B40 INC A
6B41 LD ($5E3B),A
6B44 BIT 3,(IX+$05) Test bit 3 of IX+05 (the bug moves up and down as it eats).
6B48 LD A,(IX+$06) A=the Y position the bug started eating at, from IX+06.
6B4B JR NZ,EatFlower_StoreY Jump to EatFlower_StoreY if bit 3 is set.
6B4D DEC A Move the bug up by one pixel.
EatFlower_StoreY 6B4E LD (IX+$02),A Write the new Y position.
6B51 LD A,($5E8E) A=the Y position of the flower.
6B54 SRL A Halve it.
6B56 SUB $02 Subtract 02.
6B58 LD C,A C=the position of the top of the flower.
6B59 LD A,(IX+$02) A=the Y position of the bug.
6B5C SRL A Halve it.
6B5E SUB C Subtract the flower position.
6B5F JP NC,UpdateSlug_Draw Jump to UpdateSlug_Draw to draw the bug if it is not above the flower.
6B62 RES 3,(IX+$04) Reset bit 3 of IX+04 (the bug stops eating).
6B66 XOR A A=00.
6B67 LD (IX+$05),A Write 00 to IX+05.
6B6A LD (IX+$06),A Write 00 to IX+06.
6B6D JP UpdateSlug_Draw Jump to UpdateSlug_Draw to draw the bug.
Prev: 6B20 Up: Map Next: 6B70