Prev: 7281 Up: Map Next: 7302
72A3: Move Bouncing Actor
Used by the routine at ChangeActorSpeeds.
Moves the actor by the speeds in bytes 04 and 05 of the actor, changing them to 02 or FE (-2) when the actor reaches the edge of the play area. Bit 0 of byte 06 is set while the actor is moving down, and bit 1 is set while it is moving right. The ID of the actor is changed between its two frames, and the sprite is then drawn in its new position.
Input
IX Actor
MoveBouncingActor 72A3 LD A,(IX+$02) Fetch the vertical co-ordinate.
72A6 ADD A,(IX+$05) Add the vertical speed.
72A9 CP $21 Jump to MoveBouncingActor_Top if the actor has reached the top.
72AB JR C,MoveBouncingActor_Top
72AD CP $A0 Jump to MoveBouncingActor_Bottom if the actor has reached the bottom.
72AF JR NC,MoveBouncingActor_Bottom
72B1 LD (IX+$02),A Update the vertical co-ordinate.
This entry point is used by the routines at HandleCheese and SetCustardVerticalSpeed.
MoveBouncingActor_Horizontal 72B4 LD A,(IX+$01) Fetch the horizontal co-ordinate.
72B7 ADD A,(IX+$04) Add the horizontal speed.
72BA LD (IX+$01),A Update the horizontal co-ordinate.
72BD CP $04 Jump to MoveBouncingActor_LeftEdge if the actor has reached the left edge.
72BF JR C,MoveBouncingActor_LeftEdge
72C1 CP $C0 Jump to MoveBouncingActor_RightEdge if the actor has reached the right edge.
72C3 JR NC,MoveBouncingActor_RightEdge
MoveBouncingActor_Animate 72C5 INC (IX+$07) Increase the frame counter (byte 07 of the actor) by one.
72C8 LD A,(IX+$07) Fetch the frame counter.
72CB RRA Shift A right.
72CC AND %00000001 Keep only bit 0.
72CE XOR (IX+$00) Flip bit 0 of the actor ID if bit 1 of the frame counter is set.
72D1 LD (IX+$00),A Update the actor ID.
This entry point is used by the routines at HandlePeel and HandleHitActor.
MoveBouncingActor_Draw 72D4 CALL DisplayEntity Erase the sprite and draw it in its new position using DisplayEntity.
72D7 JP ColourSprite Jump to ColourSprite to colour the sprite.
The actor has reached the top, so make it move down.
MoveBouncingActor_Top 72DA LD (IX+$05),$02 Set the vertical speed to 02 (moving down).
72DE SET 0,(IX+$06) Set bit 0 of byte 06 of the actor.
72E2 JR MoveBouncingActor_Horizontal Jump to MoveBouncingActor_Horizontal.
The actor has reached the left edge, so make it move right.
MoveBouncingActor_LeftEdge 72E4 LD (IX+$04),$02 Set the horizontal speed to 02 (moving right).
72E8 SET 1,(IX+$06) Set bit 1 of byte 06 of the actor.
72EC JR MoveBouncingActor_Animate Jump to MoveBouncingActor_Animate.
The actor has reached the bottom, so make it move up.
MoveBouncingActor_Bottom 72EE LD (IX+$05),$FE Set the vertical speed to FE (moving up).
72F2 RES 0,(IX+$06) Reset bit 0 of byte 06 of the actor.
72F6 JR MoveBouncingActor_Horizontal Jump to MoveBouncingActor_Horizontal.
The actor has reached the right edge, so make it move left.
MoveBouncingActor_RightEdge 72F8 LD (IX+$04),$FE Set the horizontal speed to FE (moving left).
72FC RES 1,(IX+$06) Reset bit 1 of byte 06 of the actor.
7300 JR MoveBouncingActor_Animate Jump to MoveBouncingActor_Animate.
Prev: 7281 Up: Map Next: 7302