Prev: A9AB Up: Map Next: AA00
A9BE: Handler: Flying Sabreman
Handles the player while they are flying through the air after being hit (sprite IDs 40 and 44). 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+02.
Input
IX Actor record of the player
HandlerFlyingSabreman A9BE CALL StoreEntity Remember the previous position of the player.
Add the velocities to the position.
A9C1 LD A,(IX+$06) Fetch the X velocity of the player.
A9C4 ADD A,(IX+$03) Add the X position of the player.
A9C7 LD E,A Stash the new X position in E.
A9C8 LD A,(IX+$04) Fetch the Y position of the player.
A9CB ADD A,(IX+$07) Add the Y velocity of the player.
A9CE LD D,A Stash the new Y position in D.
A9CF LD BC,$170F Set the height of the player in B to 17 and the width in C to 0F.
A9D2 CALL SlideActorPastObjects Stop the player passing through objects in the room.
A9D5 CALL TestPositionUnchanged Test whether the player has stayed where it was.
A9D8 JR Z,LandSabreman Jump to LandSabreman if the player did not move.
A9DA LD A,E Fetch the new X position.
A9DB CP $04 Jump to LandSabreman if the player is off the left of the play area.
A9DD JR C,LandSabreman
A9DF CP $EC Jump to LandSabreman if the player is off the right of the play area.
A9E1 JR NC,LandSabreman
A9E3 LD A,D Fetch the new Y position.
A9E4 CP $28 Jump to LandSabreman if the player is off the top of the play area.
A9E6 JR C,LandSabreman
A9E8 CP $C0 Jump to LandSabreman if the player is off the bottom of the play area.
A9EA JR NC,LandSabreman
A9EC LD (IX+$03),E Set the X position of the player.
A9EF LD (IX+$04),D Set the Y position of the player.
A9F2 CALL DisplayActor Display the player.
Play a sound which changes with the counter.
A9F5 INC (IX+$02) Increase the flying counter of the player by one.
A9F8 LD B,(IX+$02) Fetch the flying counter as the duration of the wave in B.
A9FB LD C,$04 Set the number of waves in C to 04.
A9FD JP PlayWaveSequence Jump to PlayWaveSequence to play the sound.
Prev: A9AB Up: Map Next: AA00