Prev: 27424 Up: Map Next: 27504
27450: 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 27450 INC (IX+5) Increment the eating counter in IX+5 by one.
27453 LD A,(24123) Increment BugsEating_Flower by one.
27456 INC A
27457 LD (24123),A
27460 BIT 3,(IX+5) Test bit 3 of IX+5 (the bug moves up and down as it eats).
27464 LD A,(IX+6) A=the Y position the bug started eating at, from IX+6.
27467 JR NZ,EatFlower_StoreY Jump to EatFlower_StoreY if bit 3 is set.
27469 DEC A Move the bug up by one pixel.
EatFlower_StoreY 27470 LD (IX+2),A Write the new Y position.
27473 LD A,(24206) A=the Y position of the flower.
27476 SRL A Halve it.
27478 SUB 2 Subtract 2.
27480 LD C,A C=the position of the top of the flower.
27481 LD A,(IX+2) A=the Y position of the bug.
27484 SRL A Halve it.
27486 SUB C Subtract the flower position.
27487 JP NC,UpdateSlug_Draw Jump to UpdateSlug_Draw to draw the bug if it is not above the flower.
27490 RES 3,(IX+4) Reset bit 3 of IX+4 (the bug stops eating).
27494 XOR A A=0.
27495 LD (IX+5),A Write 0 to IX+5.
27498 LD (IX+6),A Write 0 to IX+6.
27501 JP UpdateSlug_Draw Jump to UpdateSlug_Draw to draw the bug.
Prev: 27424 Up: Map Next: 27504