Prev: CE41 Up: Map Next: D05B
CFF6: Goldfish Game: Collision
Used by the routine at GoldfishGame.
The player has hit a sprite, let's see what it is.
GoldfishGame_Collision CFF6 LD A,($DC0E) C=*GoldfishGame_PlayerAttributes.
CFF9 LD C,A
CFFA LD A,(IX+$00) A=*IX+00.
CFFD SUB (IX+$07) A-=*GoldfishGame_PlayerWidth.
D000 INC A Increment A by one.
D001 SUB C A-=C.
D002 CP $02 Jump to GoldfishGame_NextCreature if A is higher than 02.
D004 JR NC,GoldfishGame_NextCreature
D006 PUSH IX Stash IX on the stack.
D008 LD HL,$0064 HL=0064.
D00B LD DE,$0064 DE=0064.
D00E CALL $03B5 Call BEEPER.
D011 POP IX Restore IX from the stack.
D013 LD A,(IX+$08) Jump to GoldfishGame_HitCreature if *IX+08 is not equal to 01.
D016 CP $01
D018 JR NZ,GoldfishGame_HitCreature
The player has caught a fish! Add it to the count and remove it from the screen.
GoldfishGame_CaughtFish D01A LD A,($DB42) Increment *GoldfishGame_FishCaught by one.
D01D INC A
D01E LD ($DB42),A
D021 LD C,(IX+$00) C=Horizontal position (*IX+00).
D024 LD B,(IX+$01) B=Vertical position (*IX+01).
D027 LD E,(IX+$07) E=*IX+07.
D02A LD D,(IX+$08) D=*IX+08.
D02D LD A,(IX+$02) Jump to GoldfishGame_Collision_0 if *IX+02 is equal to 03.
D030 CP $03
D032 JR Z,GoldfishGame_Collision_0
D034 INC E Increment E by one.
GoldfishGame_Collision_0 D035 LD HL,$9F6C Write 9F6C (Graphics_MaskSprite) to *CHARS.
D038 LD ($5C36),HL
D03B LD A,$20 A=20.
D03D CALL GoldfishGame_PrintSprite Call GoldfishGame_PrintSprite.
D040 LD (IX+$0A),$00 Write inactive (00) to *IX+0A.
D044 JP GoldfishGame_NextCreature Jump to GoldfishGame_NextCreature.
When any sea creature touches you they steal all of your fish.
GoldfishGame_HitCreature D047 XOR A Write 00 to *GoldfishGame_FishCaught.
D048 LD ($DB42),A
D04B PUSH IX Stash IX on the stack.
D04D LD HL,$00C8 HL=00C8.
D050 LD DE,$0032 DE=0032.
D053 CALL $03B5 Call BEEPER.
D056 POP IX Restore IX from the stack.
D058 JP GoldfishGame_NextCreature Jump to GoldfishGame_NextCreature.
Prev: CE41 Up: Map Next: D05B