Prev: 42670 Up: Map Next: 42762
42720: Move Pellet
The handler for entity types 48 to 55, which are the shots that the robot fires using the second weapon. A pellet moves across the map until it hits something or has run out of range.
Input
IX Entity
MovePellet 42720 CALL ToggleSprite Move on to the next sprite using ToggleSprite.
42723 CALL GetPosition Fetch the position of the pellet.
42726 LD B,192 The pellet can take up to 192 steps in this frame.
MovePellet_Step 42728 CALL TryMove Take a step using TryMove.
42731 JR NZ,MovePellet_Explode Jump if the pellet has hit something.
42733 LD A,E Jump if the pellet is not at the start of a cell.
42734 OR L
42735 JR NZ,MovePellet_Store
42737 LD A,(IX+7) Fetch the range of the pellet...
42740 SUB 16 ...take away one cell...
42742 LD (IX+7),A ...and store it.
42745 AND 240 Jump to turn the pellet into smoke if it has run out of range.
42747 JR Z,MovePellet_Explode
42749 LD A,B Loop back to take another step if there are steps left.
42750 AND A
42751 JR NZ,MovePellet_Step
MovePellet_Store 42753 JP MoveSpark_Store Store the position of the pellet, check whether it has hit an enemy and draw it using MoveSpark_Store.
MovePellet_Explode 42756 LD (IX+0),56 Turn the pellet into smoke by changing its type to 56.
42760 JR MovePellet_Store Jump back to store the position.
Prev: 42670 Up: Map Next: 42762