Prev: F673 Up: Map Next: F6D1
F674: Room logic : The Park
F674 LD A,$04 Moving objects decrease endurance by 4.
F676 LD ($F26E),A
F679 LD B,$05 5 objects to update.
F67B LD IX,$F653 Point IX at the movement table.
F67F PUSH BC Store the count in BC.
F680 LD BC,$F5CA Point BC at the bounds table.
F683 CALL $EF35 Update moving objects.
F686 DEC (IX+$00) Decrement the X position.
F689 JR NZ,$F6BB Jump forward if it's not zero.
F68B LD A,($F673) Has a bird hit a boundary in X or Y?
F68E LD B,A
F68F LD A,($F672)
F692 OR B
F693 JR NZ,$F6BB Jump forward if they haven't.
A bird has hit the edge of the screen, move them off in some random direction.
F695 LD A,R Get a random number between 14 and 53.
F697 AND $3F
F699 ADD A,$14
F69B LD (IX+$00),A Set this as the new x co-ordinate.
F69E LD A,(IX+$01) Cycle the y co-ordinate between 0 and 6 in multiples of 2, to give an offset into the table at F653.
F6A1 ADD A,$02
F6A3 CP $08
F6A5 JR NZ,$F6A8
F6A7 XOR A
F6A8 LD (IX+$01),A Set the new y co-ordinate.
F6AB LD E,A Put the y co-ordinate in DE.
F6AC LD D,$00
F6AE LD HL,$F64B Add the base address of the direction table. (F64B)
F6B1 ADD HL,DE
F6B2 LD A,(HL) Set the new x and y direction changes based on the data found.
F6B3 LD (IX-$02),A
F6B6 INC HL
F6B7 LD A,(HL)
F6B8 LD (IX-$01),A
Now draw the bird.
F6BB LD A,($F671) Get the object ID to use.
F6BE XOR $02 Alternate between 3C and 3E (8AF8). for the next iteration.
F6C0 LD ($F671),A
F6C3 CALL $A8A0 Draw the object.
F6C6 CALL $E329 Check for collision detection
F6C9 INC IX
F6CB INC IX
F6CD POP BC Restore the count in BC.
F6CE DJNZ $F67F Loop while there are more objects to draw.
F6D0 RET Otherwise return.
Prev: F673 Up: Map Next: F6D1