Prev: 43435 Up: Map Next: 43520
43454: Handler: Flying Sabreman
Handles the player while they are flying through the air after being hit (sprite IDs 64 and 68). The player moves with the velocity set up by KnockPlayerBack and falls to the ground when they hit an object or the edge of the play area. A sound is played with a pitch which changes with the counter in IX+2.
Input
IX Actor record of the player
HandlerFlyingSabreman 43454 CALL StoreEntity Remember the previous position of the player.
Add the velocities to the position.
43457 LD A,(IX+6) Fetch the X velocity of the player.
43460 ADD A,(IX+3) Add the X position of the player.
43463 LD E,A Stash the new X position in E.
43464 LD A,(IX+4) Fetch the Y position of the player.
43467 ADD A,(IX+7) Add the Y velocity of the player.
43470 LD D,A Stash the new Y position in D.
43471 LD BC,5903 Set the height of the player in B to 23 and the width in C to 15.
43474 CALL SlideActorPastObjects Stop the player passing through objects in the room.
43477 CALL TestPositionUnchanged Test whether the player has stayed where it was.
43480 JR Z,LandSabreman Jump to LandSabreman if the player did not move.
43482 LD A,E Fetch the new X position.
43483 CP 4 Jump to LandSabreman if the player is off the left of the play area.
43485 JR C,LandSabreman
43487 CP 236 Jump to LandSabreman if the player is off the right of the play area.
43489 JR NC,LandSabreman
43491 LD A,D Fetch the new Y position.
43492 CP 40 Jump to LandSabreman if the player is off the top of the play area.
43494 JR C,LandSabreman
43496 CP 192 Jump to LandSabreman if the player is off the bottom of the play area.
43498 JR NC,LandSabreman
43500 LD (IX+3),E Set the X position of the player.
43503 LD (IX+4),D Set the Y position of the player.
43506 CALL DisplayActor Display the player.
Play a sound which changes with the counter.
43509 INC (IX+2) Increase the flying counter of the player by one.
43512 LD B,(IX+2) Fetch the flying counter as the duration of the wave in B.
43515 LD C,4 Set the number of waves in C to 4.
43517 JP PlayWaveSequence Jump to PlayWaveSequence to play the sound.
Prev: 43435 Up: Map Next: 43520