Prev: A6AE Up: Map Next: A70A
A6E0: Move Pellet
The handler for entity types 30 to 37, 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 A6E0 CALL ToggleSprite Move on to the next sprite using ToggleSprite.
A6E3 CALL GetPosition Fetch the position of the pellet.
A6E6 LD B,$C0 The pellet can take up to C0 steps in this frame.
MovePellet_Step A6E8 CALL TryMove Take a step using TryMove.
A6EB JR NZ,MovePellet_Explode Jump if the pellet has hit something.
A6ED LD A,E Jump if the pellet is not at the start of a cell.
A6EE OR L
A6EF JR NZ,MovePellet_Store
A6F1 LD A,(IX+$07) Fetch the range of the pellet...
A6F4 SUB $10 ...take away one cell...
A6F6 LD (IX+$07),A ...and store it.
A6F9 AND $F0 Jump to turn the pellet into smoke if it has run out of range.
A6FB JR Z,MovePellet_Explode
A6FD LD A,B Loop back to take another step if there are steps left.
A6FE AND A
A6FF JR NZ,MovePellet_Step
MovePellet_Store A701 JP MoveSpark_Store Store the position of the pellet, check whether it has hit an enemy and draw it using MoveSpark_Store.
MovePellet_Explode A704 LD (IX+$00),$38 Turn the pellet into smoke by changing its type to 38.
A708 JR MovePellet_Store Jump back to store the position.
Prev: A6AE Up: Map Next: A70A