Prev: 8E26 Up: Map Next: 8ED7
8EA0: Lose Life
Takes one of the lives of the player, or ends the game if there are none left. The player is set to the vanishing sprite 67 (see HandlerPlayerVanishing), with the number of rows to erase (at offset 06) set to the height of the sprite and the sprite ID that it came from (at offset 07). If the entity is a character then the position that was saved by StoreEntity is used first.
Input
IX The entity of the character
LoseLife 8EA0 LD A,($5E21) Fetch the number of lives from PlayerLives.
8EA3 AND A Test whether there are no lives left.
8EA4 JP Z,GameOver Jump to GameOver if there are none.
8EA7 DEC A Decrease the number of lives by one.
8EA8 LD ($5E21),A Update the number of lives in PlayerLives.
8EAB LD A,(IX+$00) Fetch the sprite ID of the entity.
8EAE DEC A Subtract one to get the ID that starts at zero.
8EAF CP $30 Jump to LoseLife_Character if the entity is a character.
8EB1 JR C,LoseLife_Character
8EB3 LD A,($EA90) Fetch the sprite ID of the player from Player.
LoseLife_Vanish 8EB6 LD ($EA97),A Store the sprite ID of the player at offset 07.
8EB9 CALL FetchSprite Call FetchSprite to get the address of the sprite data.
8EBC LD A,(DE) Fetch the height of the sprite.
8EBD LD ($EA96),A Store the height of the sprite at offset 06 as the number of rows to draw.
8EC0 LD A,$67 A=67 (the vanishing player).
8EC2 LD ($EA90),A Update the sprite ID of the player.
8EC5 RET Return.
Use the position and the sprite that were saved.
LoseLife_Character 8EC6 LD A,($5E16) Fetch the previous X position from Previous_X_Position.
8EC9 LD ($EA93),A Update the X position of the player.
8ECC LD A,($5E17) Fetch the previous Y position from Previous_Y_Position.
8ECF LD ($EA94),A Update the Y position of the player.
8ED2 LD A,($5E15) Fetch the previous sprite ID from Previous_Sprite_Id.
8ED5 JR LoseLife_Vanish Jump to LoseLife_Vanish to start the player vanishing.
Prev: 8E26 Up: Map Next: 8ED7