Prev: 29313 Up: Map Next: 29442
29347: Move Bouncing Actor
Used by the routine at ChangeActorSpeeds.
Moves the actor by the speeds in bytes 4 and 5 of the actor, changing them to 2 or 254 (-2) when the actor reaches the edge of the play area. Bit 0 of byte 6 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 29347 LD A,(IX+2) Fetch the vertical co-ordinate.
29350 ADD A,(IX+5) Add the vertical speed.
29353 CP 33 Jump to MoveBouncingActor_Top if the actor has reached the top.
29355 JR C,MoveBouncingActor_Top
29357 CP 160 Jump to MoveBouncingActor_Bottom if the actor has reached the bottom.
29359 JR NC,MoveBouncingActor_Bottom
29361 LD (IX+2),A Update the vertical co-ordinate.
This entry point is used by the routines at HandleCheese and SetCustardVerticalSpeed.
MoveBouncingActor_Horizontal 29364 LD A,(IX+1) Fetch the horizontal co-ordinate.
29367 ADD A,(IX+4) Add the horizontal speed.
29370 LD (IX+1),A Update the horizontal co-ordinate.
29373 CP 4 Jump to MoveBouncingActor_LeftEdge if the actor has reached the left edge.
29375 JR C,MoveBouncingActor_LeftEdge
29377 CP 192 Jump to MoveBouncingActor_RightEdge if the actor has reached the right edge.
29379 JR NC,MoveBouncingActor_RightEdge
MoveBouncingActor_Animate 29381 INC (IX+7) Increase the frame counter (byte 7 of the actor) by one.
29384 LD A,(IX+7) Fetch the frame counter.
29387 RRA Shift A right.
29388 AND %00000001 Keep only bit 0.
29390 XOR (IX+0) Flip bit 0 of the actor ID if bit 1 of the frame counter is set.
29393 LD (IX+0),A Update the actor ID.
This entry point is used by the routines at HandlePeel and HandleHitActor.
MoveBouncingActor_Draw 29396 CALL DisplayEntity Erase the sprite and draw it in its new position using DisplayEntity.
29399 JP ColourSprite Jump to ColourSprite to colour the sprite.
The actor has reached the top, so make it move down.
MoveBouncingActor_Top 29402 LD (IX+5),2 Set the vertical speed to 2 (moving down).
29406 SET 0,(IX+6) Set bit 0 of byte 6 of the actor.
29410 JR MoveBouncingActor_Horizontal Jump to MoveBouncingActor_Horizontal.
The actor has reached the left edge, so make it move right.
MoveBouncingActor_LeftEdge 29412 LD (IX+4),2 Set the horizontal speed to 2 (moving right).
29416 SET 1,(IX+6) Set bit 1 of byte 6 of the actor.
29420 JR MoveBouncingActor_Animate Jump to MoveBouncingActor_Animate.
The actor has reached the bottom, so make it move up.
MoveBouncingActor_Bottom 29422 LD (IX+5),254 Set the vertical speed to 254 (moving up).
29426 RES 0,(IX+6) Reset bit 0 of byte 6 of the actor.
29430 JR MoveBouncingActor_Horizontal Jump to MoveBouncingActor_Horizontal.
The actor has reached the right edge, so make it move left.
MoveBouncingActor_RightEdge 29432 LD (IX+4),254 Set the horizontal speed to 254 (moving left).
29436 RES 1,(IX+6) Reset bit 1 of byte 6 of the actor.
29440 JR MoveBouncingActor_Animate Jump to MoveBouncingActor_Animate.
Prev: 29313 Up: Map Next: 29442