Prev: EF6B Up: Map Next: EFE7
EF71: Room Event : Darts
Used by the routine at Update_Room00.
Input
Output
Handler_Darts EF71 LD A,(Flag_BaddyInit) See if baddies need initializing.
EF74 OR A
EF75 JR NZ,Handler_Darts_0
Init
EF77 LD A,$01
EF79 LD (Flag_BaddyInit),A
EF7C LD HL,$8808
EF7F LD (Dart1_Pos),HL
EF82 LD (BitmapX),HL
EF85 LD A,(Dart_Bmp)
EF88 CALL Bitmap16Draw
EF8B LD HL,$A878
EF8E LD (Dart2_Pos),HL
EF91 LD (BitmapX),HL
EF94 CALL Bitmap16Draw
EF97 RET
Animate
Handler_Darts_0 EF98 LD IX,Dart1_Pos Use indexing for getting each darts position.
EF9C LD B,$02 Number of darts to draw.
EF9E LD A,(Dart_Bmp) Index to bitmap used by both darts.
EFA1 LD HL,$EF70
EFA4 DEC (HL)
EFA5 JR NZ,Handler_Darts_1
EFA7 LD (HL),$02
EFA9 INC A Next frame in animation.
EFAA CP $93 Past the last frame?
EFAC JR NZ,Handler_Darts_1
EFAE LD A,$90 Reset back to first frame.
Handler_Darts_1 EFB0 LD D,A Store index value.
Handler_Darts_2 EFB1 LD L,(IX+$00) GEt position of next dart to draw.
EFB4 LD H,(IX+$01)
EFB7 INC IX Move index on, ready for next dart.
EFB9 INC IX
EFBB LD A,(Dart_Bmp) Get previous bitmap frame.
EFBE LD (BitmapX),HL Set up position of bitmap and draw in order erase previous draw.
EFC1 CALL Bitmap16Draw
EFC4 INC L Move x position along two to the right.
EFC5 INC L
EFC6 LD A,L Check for end of screen.
EFC7 CP $F0
EFC9 JR C,Handler_Darts_3
EFCB LD L,$08 Reset to left of screen if need be.
Handler_Darts_3 EFCD LD (BitmapX),HL Set new position and draw with new frame.
EFD0 LD A,D
EFD1 CALL Bitmap16Draw
EFD4 LD (IX-$02),L Store new position.
EFD7 PUSH BC
EFD8 PUSH DE
EFD9 LD B,$01 Check for Wally, losing 1 bar of energy if hit.
EFDB CALL Wally_HitTest
EFDE POP DE
EFDF POP BC
EFE0 DJNZ Handler_Darts_2 Next dart.
EFE2 LD A,D Store new frame ready for next time.
EFE3 LD (Dart_Bmp),A
EFE6 RET
Prev: EF6B Up: Map Next: EFE7